Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update auth.py #9

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions pyarubaoss/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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

Expand Down