tejado / pgoapi

Pokemon Go API lib
Other
1.4k stars 447 forks source link

Add username to "Could not retrieve token" error message in auth_ptc.py #209

Open SchwarzwaldFalke opened 7 years ago

SchwarzwaldFalke commented 7 years ago

Currently it's pretty hard to debug (if multiple accounts are used) which account throws the "Could not retrieve token"-Exception, since the username isn't mentioned. As a quick fix I changed the error message in auth_ptc.py:

try:
       self.log.error('Could not retrieve token (%s) Username: %s.', r1.json()['errors'][0],username)
except Exception as e:
       self.log.error('Could not retrieve token! (%s) Username: %s.', e,username)
return False

Output:

Could not retrieve token (Account is not yet active, please redirect.) Username: asdasdasd.

Can someone with more Python experience check and improve my quick fix?