Skip to content

Commit

Permalink
Shim 1.5.0 gettoken behaviour
Browse files Browse the repository at this point in the history
Signed-off-by: Olivier Mehani <[email protected]>
  • Loading branch information
shtrom committed Aug 13, 2023
1 parent b35de50 commit 8f351c4
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion auroraplus/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,18 @@ def __init__(self, username, password):
session.mount(self.url, api_adapter)
session.headers.update({'Accept': 'application/json', 'User-Agent': 'AuroraPlus.py', 'Accept-Encoding': 'gzip, deflate, br', 'Connection': 'keep-alive'})
self.session = session
self._username = username
self._password = password

"""Try to get token, retry if failed"""
self.gettoken(username, password)

def gettoken(self, username, password):
def gettoken(self, username=None, password=None):
"""Get access token"""
if not username:
username = self._username
if not password:
password = self._password
try:
token = self.session.post(self.url + '/identity/login', data={'username': username, 'password': password}, timeout=(6))

Expand Down

0 comments on commit 8f351c4

Please sign in to comment.