PokemonGo-Bot icon indicating copy to clipboard operation
PokemonGo-Bot copied to clipboard

pgoapi.exceptions.UnexpectedResponseException: Unexpected HTTP server response - needs 200 got 502

Open JSchwerberg opened this issue 10 years ago • 3 comments

Expected Behavior

Bot continues to run, doesn't crash

Actual Behavior

Traceback (most recent call last):
  File "./pokecli.py", line 442, in <module>
    main()
  File "./pokecli.py", line 85, in main
    report_summary(bot)
  File "./pokecli.py", line 93, in report_summary
    metrics.capture_stats()
  File "/home/junaos/PokemonGo-Bot/pokemongo_bot/metrics.py", line 76, in capture_stats
    response_dict = request.call()
  File "/home/junaos/PokemonGo-Bot/pokemongo_bot/api_wrapper.py", line 100, in call
    result = self._call()
  File "/home/junaos/PokemonGo-Bot/pokemongo_bot/api_wrapper.py", line 60, in _call
    return PGoApiRequest.call(self)
  File "/home/junaos/PokemonGo-Bot/src/pgoapi/pgoapi/pgoapi.py", line 182, in call
    response = request.request(self._api_endpoint, self._req_method_list, self.get_position())
  File "/home/junaos/PokemonGo-Bot/src/pgoapi/pgoapi/rpc_api.py", line 106, in request
    response_dict = self._parse_main_response(response, subrequests)
  File "/home/junaos/PokemonGo-Bot/src/pgoapi/pgoapi/rpc_api.py", line 237, in _parse_main_response
    raise UnexpectedResponseException(error)
pgoapi.exceptions.UnexpectedResponseException: Unexpected HTTP server response - needs 200 got 502

Steps to Reproduce

Nothing in particular -- just started happening as of 23:25 UTC, is now happening frequently.

502 is bad gateway, so the servers may be overloaded; we should catch this exception and retry.

Other Information

OS: Ubuntu 14.04.4 LTS Git Commit: bdf2e7d9cc0b2fa5fb04bb9dc4f9f09f967cd9ea Python Version: Python 2.7.6

JSchwerberg avatar Aug 02 '16 22:08 JSchwerberg

Niantic is starting to change things ... getting this too, and some other like 'GET_INVENTORY']['inventory_delta']['inventory_items'] KeyError: 'inventory_delta'

DayBr3ak avatar Aug 02 '16 22:08 DayBr3ak

Well, 502 is just an HTTP error code for Bad Gateway; I'm willing to put money on their infrastructure just being overloaded. Either way, #2407 was submitted to catch this one and retry, using similar logic to your fixes for throttling in the refactor :)

JSchwerberg avatar Aug 02 '16 23:08 JSchwerberg

PR fixing merged.

douglascamata avatar Aug 03 '16 00:08 douglascamata