diff --git a/pyarubaoss/auth.py b/pyarubaoss/auth.py index d20b4ab..4b10a06 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) @@ -18,8 +18,8 @@ def __init__(self, switchip, username, password, version="v3"): self.version = version - def logout(self): - url_login = "http://" + self.ipaddr + "/rest/v1/login-sessions" + 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