79299841

Date: 2024-12-21 17:47:36
Score: 0.5
Natty:
Report link

I may assume the next:

     if 'access_token' in data:
        token = '{0} {1}'.format(data['token_type'], data['access_token'])
        update_session('Authorization', token)
        set_login_state(True)
        data['detail'] = "logged in with brand new authentication code."
        if store_session:
            with open(pickle_path, 'wb') as f:
                pickle.dump({'token_type': data['token_type'],
                             'access_token': data['access_token'],
                             'refresh_token': data['refresh_token'],
                             'device_token': payload['device_token']}, f) else:
        raise Exception(data['detail'])

so, I think access_token is not in data and part raise Exception(data['detail']) is invoked, but your data does not contain detail field and KeyError: 'detail' is raised.

Reasons:
  • Probably link only (1):
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Low reputation (0.5):
Posted by: koko