pogodevorg / pgoapi

Unofficial PokemonGO API in Python
https://pogodev.org
Other
851 stars 474 forks source link

set_favorite_pokemon API call fails if passed any pokemon_id greater than 9223372036854775807 #195

Open snicker opened 7 years ago

snicker commented 7 years ago

I was adding a method to my organizer tool to allow me to favorite/unfavorite Pokemon and noticed that it would work intermittently, occasionally giving this error:

WARNING:pgoapi.rpc_api:Argument pokemon_id with value 12784024686362352118 unknown inside set_favorite_pokemon_message (Exception: 'int' object has no attribute 'append')

couldn't figure it out at first, but it appears that anything greater than the max positive value for a signed 64bit integer causes this failure. However, Pokemon IDs seem to be unsigned 64 bit ints. I tested this and I was able to use set_favorite_pokemon on pokemon_ids less than 9223372036854775807, anything greater than this failed.

I don't know if this has to do with Protos or pgoapi. I tried manipulating the types in the set_favorite_pokemon_message to match those in release_pokemon_message (as this API call works with the uint64 pokemon_id) to no result, but the coincidence leads me to believe it's a typing error somewhere along the line.

snicker commented 7 years ago

a workaround shared by @petrklic in Discord:

set_favorite_pokemon, it seems this workaround works: set_favorite_pokemon(pokemon_id=p_id if p_id < 2**63 else p_id-2**64, is_favorite=favorite)