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

error when the responses is empty

Open LuyiTian opened this issue 10 years ago • 4 comments

Expected Behavior

Actual Behavior

  File ".../PokemonGo-Bot-dev/pokemongo_bot/stepper.py", line 89, in _work_at_position
    json.dump({'lat': lat, 'lng': lng,'cells':response_dict['responses']['GET_MAP_OBJECTS']['map_cells']}, outfile)
KeyError: 'GET_MAP_OBJECTS'
  File ".../PokemonGo-Bot/pokemongo_bot/__init__.py", line 310, in pokeball_inventory
    inventory_dict = inventory_req['responses']['GET_INVENTORY'][
KeyError: 'GET_INVENTORY'
[2016-07-24 21:10:43] [#] Finished walking
[2016-07-24 21:10:43] [#] Arrived at Pokestop
2016-07-24 21:10:47 [#] Now at Pokestop: Unknown - Spinning...

Steps to Reproduce

Other Information

I wonder is there a systematic way to solve the issue when the http response is empty.

I think all the error above come from an empty responses. And I have noticed you add some ifcondition to see whether the key exist. but it would be painful to add if condition everywhere. Sometime the return is empty just because unstable network and you can try resend and get the result. but sometimes it might because your account is offline.

LuyiTian avatar Jul 24 '16 11:07 LuyiTian

Perhaps one could just catch this behavior and restart the bot at current position automatically?

sakulstra avatar Jul 24 '16 12:07 sakulstra

Please confirm if issue persists with commit ec1ba9b8c914ddb914e4901b632556ad840ccf42 as changes was made to code related to this issue

fredrik-hellmangroup avatar Jul 24 '16 22:07 fredrik-hellmangroup

I got the issue today. Same as OP

iggut avatar Jul 25 '16 22:07 iggut

Got issue today

kriswong avatar Jul 27 '16 04:07 kriswong