From d6b00b34b271da950be56ccfe108ce66cfabe568 Mon Sep 17 00:00:00 2001 From: Pack3tL0ss Date: Thu, 21 Dec 2017 02:22:53 -0500 Subject: [PATCH 1/2] Update auth.py Updated auth to use version as parameter vs. hard-coded v1. v1 returns 404 in 16.04.0008 --- pyarubaoss/auth.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pyarubaoss/auth.py b/pyarubaoss/auth.py index d20b4ab..adde21a 100644 --- a/pyarubaoss/auth.py +++ b/pyarubaoss/auth.py @@ -8,8 +8,8 @@ class AOSSAuth(): This class requests and stores an authentication cookie for the Aruba AOS Switch Software. """ - def __init__(self, switchip, username, password, version="v3"): - url_login = "http://" + switchip + "/rest/v1/login-sessions" + def __init__(self, switchip, username, password, version): + url_login = "http://" + switchip + "/rest/" + version + "/login-sessions" payload_login = {"userName": username, "password": password} s = requests.Session() response = s.post(url_login, data=json.dumps(payload_login), timeout=1) @@ -19,7 +19,7 @@ def __init__(self, switchip, username, password, version="v3"): def logout(self): - url_login = "http://" + self.ipaddr + "/rest/v1/login-sessions" + url_login = "http://" + self.ipaddr + "/rest/" + version + "/login-sessions" r = requests.delete(url_login, headers=self.cookie) return r.status_code From 2c7d5906f8416f4ddc49e2cdc64ad9ed75ceacdf Mon Sep 17 00:00:00 2001 From: Pack3tL0ss Date: Thu, 21 Dec 2017 03:14:12 -0500 Subject: [PATCH 2/2] Update auth.py --- pyarubaoss/auth.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyarubaoss/auth.py b/pyarubaoss/auth.py index adde21a..4b10a06 100644 --- a/pyarubaoss/auth.py +++ b/pyarubaoss/auth.py @@ -18,7 +18,7 @@ def __init__(self, switchip, username, password, version): self.version = version - def logout(self): + def logout(self, version): url_login = "http://" + self.ipaddr + "/rest/" + version + "/login-sessions" r = requests.delete(url_login, headers=self.cookie) return r.status_code