Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from pgoapi import PGoApi
- import pprint
- api = PGoApi()
- lat = 33.922605
- lng = -84.346709
- user="foo@gmail.com"
- password="bar1234"
- api.set_position(lat, lng, 0.0)
- if not api.login('google', user, password):
- raise AssertionError('Failed to log in!')
- def dump(response):
- print('Response:\n\r{}'.format(pprint.PrettyPrinter(indent=4).pformat(response)))
- api.get_player()
- response = api.call()
- #dump(response)
- api.get_inventory()
- response = api.call()
- #dump(response)
- # filtered (pidgeys and pidgeottos)
- pokemon = [x for x in response.get('responses', {}).get('GET_INVENTORY', {}).get('inventory_delta', {}).get('inventory_items', {}) if x.get('inventory_item_data', {}).get('pokemon_data', {}).get('pokemon_id', {}) in [16,17]]
- # unfiltered
- pokemon = [x for x in response.get('responses', {}).get('GET_INVENTORY', {}).get('inventory_delta', {}).get('inventory_items', {}) if x.get('inventory_item_data', {}).get('pokemon_data', {}).get('pokemon_id', {})]
- pokemon.sort(key=lambda x: x['inventory_item_data']['pokemon_data']['creation_time_ms'])
- dump(pokemon)
- # drop to a shell
- #from IPython import embed; embed()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement