Skip to content

Add some try catch logic around failed API requests #18

Description

@timwah
2016-07-28T22:24:59.468283+00:00 app[worker.1]: INFO:pokesearch:Completed  6.56% of scan.
2016-07-28T22:25:00.617325+00:00 app[worker.1]:   File "main.py", line 56, in <module>
2016-07-28T22:25:00.617343+00:00 app[worker.1]:     for pokemon in pokesearch.search(position, num_steps):
2016-07-28T22:25:00.617366+00:00 app[worker.1]:   File "/app/pokesearch.py", line 72, in search
2016-07-28T22:25:00.617315+00:00 app[worker.1]: Traceback (most recent call last):
2016-07-28T22:25:00.617514+00:00 app[worker.1]:     response_dict = self.api.call()
2016-07-28T22:25:00.617561+00:00 app[worker.1]:     response = request.request(api_endpoint, self._req_method_list, player_position)
2016-07-28T22:25:00.617706+00:00 app[worker.1]:     response_dict = self._parse_main_response(response, subrequests)
2016-07-28T22:25:00.617730+00:00 app[worker.1]:   File "/app/.heroku/src/pgoapi/pgoapi/rpc_api.py", line 201, in _parse_main_response
2016-07-28T22:25:00.617792+00:00 app[worker.1]:     response_proto_dict = self._parse_sub_responses(response_proto, subrequests, response_proto_dict)
2016-07-28T22:25:00.617518+00:00 app[worker.1]:   File "/app/.heroku/src/pgoapi/pgoapi/pgoapi.py", line 80, in call
2016-07-28T22:25:00.617657+00:00 app[worker.1]:   File "/app/.heroku/src/pgoapi/pgoapi/rpc_api.py", line 93, in request
2016-07-28T22:25:00.617811+00:00 app[worker.1]:   File "/app/.heroku/src/pgoapi/pgoapi/rpc_api.py", line 208, in _parse_sub_responses
2016-07-28T22:25:00.617867+00:00 app[worker.1]:     del response_proto_dict['returns']
2016-07-28T22:25:00.617909+00:00 app[worker.1]: KeyError: 'returns'
2016-07-28T22:25:00.760691+00:00 heroku[worker.1]: Process exited with status 1
2016-07-28T22:25:00.775516+00:00 heroku[worker.1]: State changed from up to crashed

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions