Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Occasional KeyError when logging in #77

Closed
MarcoGlauser opened this issue Jul 22, 2016 · 3 comments
Closed

Occasional KeyError when logging in #77

MarcoGlauser opened this issue Jul 22, 2016 · 3 comments

Comments

@MarcoGlauser
Copy link

First of all thanks for the great API!
I occasionally get the following stack trace when trying to login. I can't exactly reproduce it. It just happens from time to time.

File "/home/mglauser/PycharmProjects/pokemap/pokeworld/views.py", line 31, in asdf
if not api.login(config['auth_service'], config['username'], config['password']):
File "/home/mglauser/PycharmProjects/pokemap/venv/local/lib/python2.7/site-packages/pgoapi/pgoapi.py", line 157, in login
response = self.call()
File "/home/mglauser/PycharmProjects/pokemap/venv/local/lib/python2.7/site-packages/pgoapi/pgoapi.py", line 80, in call
response = request.request(api_endpoint, self._req_method_list, player_position)
File "/home/mglauser/PycharmProjects/pokemap/venv/local/lib/python2.7/site-packages/pgoapi/rpc_api.py", line 93, in request
response_dict = self._parse_main_response(response, subrequests)
File "/home/mglauser/PycharmProjects/pokemap/venv/local/lib/python2.7/site-packages/pgoapi/rpc_api.py", line 201, in _parse_main_response
response_proto_dict = self._parse_sub_responses(response_proto, subrequests, response_proto_dict)
File "/home/mglauser/PycharmProjects/pokemap/venv/local/lib/python2.7/site-packages/pgoapi/rpc_api.py", line 208, in _parse_sub_responses
del response_proto_dict['returns']
KeyError: 'returns'

@tejado
Copy link
Owner

tejado commented Jul 22, 2016

Oh, thanks! I will fix it.

@tejado
Copy link
Owner

tejado commented Jul 22, 2016

Fixed 1f25e90

@Wegi
Copy link

Wegi commented Jul 22, 2016

Thanks for the fix. It seems the API occasionally does not return a valid response. At least your fix fixes the error on the API side. ;)

// Tested a few more times. It may be possible, that they either rate limi the requests or timeban certain ips for relogging to often.

@tejado tejado closed this as completed Jul 29, 2016
dmadisetti pushed a commit to CyberSecurityUSC/pgoapi that referenced this issue Aug 11, 2016
The proxy code got left behind when sessions were moved to the PGoApi
object, so I applied it to the new sessions and simplified the code.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants