request.get_gym_details fails with [pokemongo_bot.api_wrapper] [WARNING] Server seems to be busy or offline - try again - 1/15
See original GitHub issueHi,
I am sorry if this is not the right way to ask for guidance in sharing my progress with adding some new features to the code, but this is my first time I am actually developing python code or even using github. In short I am trying to implement a feature that whenever a spot in a gym is available, the bot will place a mon inside the gym. So i’ve created some very basic and crude code that should do the job, however it seems I run into an error when I try to retreive the GYM_DETAILS. I’ve upgraded the API to version 0.67.2 so that should be OK without problems.
First of all I would like to share my code. I’ve placed this inside file \pokemongo_bot\cell_workers\spin_fort.py Around line 77, I’ve added the following QUICK and DIRTY code. Note that it is just a proof of concept, so the code is very crude.
`
lat = fort['latitude']
lng = fort['longitude']
details = fort_details(self.bot, fort['id'], lat, lng)
fort_name = details.get('name', 'Unknown')
#NEW CODE ADDED
fort_type = details.get('type', '1')
fort_id = fort['id']
if fort_type != 1:
"""
This is a gym. Get the gym info
"""
from pgoapi import PGoApi
PGoAPI_version = PGoApi.get_api_version()
PGoAPI_version_str = str(PGoAPI_version)
PGoAPI_version_str = "0."+ PGoAPI_version_str[0:2] + "." + PGoAPI_version_str[-1]
request = self.bot.api.create_request()
request.get_gym_details(gym_id=fort_id, player_latitude=lat, player_longitude=lng, gym_latitude=lat, gym_longitude=lng, client_version=PGoAPI_version_str)
try:
response_gym_dict = request.call()
GYMDETAILS = response_gym_dict['responses']['GET_GYM_DETAILS']
except Exception:
pass
#NEW CODE END
`
When I execute this code, it starts calling GET_GYM_DETAILS from the API, but it seems that it runs into an error. On the screen I see the following:
[pokemongo_bot.api_wrapper] [WARNING] Server seems to be busy or offline - try again - 1/15
I added some debug details to find out what is going on in the wrapper and see the variables contents. This is what they are:
api_req_method_list=[(134, {‘player_latitude’: 52.090977, ‘gym_latitude’: 52.090977, ‘player_longitude’: 5.09591, ‘gym_id’: u’14ea1a37c420456d8224a6f700477454.16’, ‘gym_longitude’: 5.09591, ‘client_version’: u’0.67.2’})] result=None request_callers=[‘GET_GYM_DETAILS’]
As a test I also tried to call some other methods like
request.fort_details(fort_id=fort_id, latitude=lat, longitude=lng)
and they just work fine. So I have no clue on how to fix this error in getting the gym details. Any ideas / suggestions?
Issue Analytics
- State:
- Created 6 years ago
- Comments:33 (33 by maintainers)
p.s., pushing your changes with a pull request, to speed up pgoapi https://github.com/pogodevorg/pgoapi/pull/210
I think that would be ok.