Validate token returns dict no matter what

This commit is contained in:
Matt 2020-05-24 16:26:39 -04:00
parent de95d23e5a
commit 9c11dbc113
2 changed files with 4 additions and 5 deletions

View file

@ -434,7 +434,7 @@ class API(object):
if response.status_code == 200:
return response.json()
else:
return response.status_code
return { 'Status_Code': response.status_code }
def get_public_info(self, server_address):
response = self.send_request(server_address, "system/info/public")

View file

@ -309,7 +309,7 @@ class ConnectionManager(object):
elif verify_authentication and server.get('AccessToken'):
system_info = self.API.validate_authentication_token(server)
if system_info and type(system_info) == dict:
if 'Status_Code' not in system_info:
self._update_server_info(server, system_info)
self.config.data['auth.user_id'] = server['UserId']
@ -319,9 +319,8 @@ class ConnectionManager(object):
server['UserId'] = None
server['AccessToken'] = None
return {
'State': CONNECTION_STATE['Unavailable'],
'Status_Code': system_info}
system_info['State'] = CONNECTION_STATE['Unavailable']
return system_info
self._update_server_info(server, system_info)