You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
def run(self):
self.stopped = False
while not self.stopped:
try:
check_time = time()
if check_time >= self.token_info["refreshToken"] and self.logged_in:
if self.username and self.password:
self.login(self.username, self.password)
else:
logger.error("No username or password provided!")
sleep(1)
except Exception as e:
logger.exception(e)
break
except KeyboardInterrupt:
break
checks the self.token_info["refreshToken"], but self.token_info attribute is not updated in the login method:
def login(self, username, password):
"""Authorization on the host and saving the toke information"""
if self.username is None and self.password is None:
self.username = username
self.password = password
self.logged_in = True
token_json = post(self.base_url + "/api/auth/login", json={"username": username, "password": password}).json()
token = None
if isinstance(token_json, dict) and token_json.get("token") is not None:
token = token_json["token"]
self.configuration.api_key_prefix["X-Authorization"] = "Bearer"
self.configuration.api_key["X-Authorization"] = token
self.api_client = ApiClient(self.configuration)
self.__load_controllers()
I presume that token_json variable here and following lines - was meant to be self.token_info and all would be working fine.
Update:
it will not work, it is also needed to parse the token expiration from the token.
The text was updated successfully, but these errors were encountered:
The problem is that thread function
checks the
self.token_info["refreshToken"]
, butself.token_info
attribute is not updated in the login method:I presume that
token_json
variable here and following lines - was meant to beself.token_info
and all would be working fine.Update:
it will not work, it is also needed to parse the token expiration from the token.
The text was updated successfully, but these errors were encountered: