pgoapi icon indicating copy to clipboard operation
pgoapi copied to clipboard

How to use get_gym_details function?

Open legz opened this issue 9 years ago • 4 comments

I try to use get_gym_details to collect some info on the gyms around me but I can't figure how to use the function. I tried this :

    gym={
        'gid':'0d39156d87f74263ac595d3ab2a2f728.16',
        'glatitude':45.876373,
        'glongitude':4.713474
        }
response= api.get_gym_details(gym_id = gym['gid'], gym_latitude = gym['glatitude'], gym_longitude = gym['glongitude'])
print('Response : \n\r{}'.format(pprint.PrettyPrinter(indent=4).pformat(response)))

But all I get is this:

...
[ INFO] Login process completed
[ INFO] Creating a new direct request...
[ INFO] Adding 'GET_GYM_DETAILS' to RPC request including arguments
[ INFO] Execution of RPC
[ INFO] Cleanup of request!
Response : 
{   'request_id': 746011827811372547L,
    'responses': {   'GET_GYM_DETAILS': {   'result': 2}},
    'status_code': 1}

Any idea on how to do a proper get_gym_details request please?

legz avatar Aug 08 '16 19:08 legz

Here is the proto: https://github.com/AeonLucid/POGOProtos/blob/master/src/POGOProtos/Networking/Requests/Messages/GetGymDetailsMessage.proto Your method call is missing the players lat/long.

genIterator avatar Aug 09 '16 12:08 genIterator

I though it was optional, thanks. I updated my request with this :

    gym={
        'gid':'7a7fcf27f2b848b2a8fc312a839471f9.11',
        'glatitude':45.773084,
        'glongitude':4.808241
        }
    response= api.get_gym_details(
        gym_id = gym['gid'],
        player_latitude = position[0],
        player_longitude = position[1],
        gym_latitude = gym['glatitude'],
        gym_longitude = gym['glongitude'])
    print('Response : \n\r{}'.format(pprint.PrettyPrinter(indent=4).pformat(response)))

but I have the exact same result. (player position is 45.7730123, 4.8084165, there is 15m between player position and gym position.)

legz avatar Aug 09 '16 13:08 legz

Well, the proto states that result 2 is ERROR_NOT_IN_RANGE: https://github.com/AeonLucid/POGOProtos/blob/master/src/POGOProtos/Networking/Responses/GetGymDetailsResponse.proto Might be an issue due to the fact that the API is not up to date. See the pull request for further details and links: https://github.com/tejado/pgoapi/pull/182

genIterator avatar Aug 09 '16 13:08 genIterator

I already use the KeyPhact version with uk6 &co (they closed my issue on their repo without much investigation btw)

legz avatar Aug 09 '16 13:08 legz