Advertisement
grodobean

PyPoGoApiTool

Aug 8th, 2016
161
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.59 KB | None | 0 0
  1. import os
  2. import sys
  3. import json
  4. import time
  5. import pprint
  6. import logging
  7. import getpass
  8. import argparse
  9. import pgoapi
  10. import requests
  11. import pprint
  12. from pgoapi import RpcApi
  13. from pgoapi import protos
  14. from pgoapi import utilities as util
  15. def get_location():
  16.     response = requests.get('https://maps.googleapis.com/maps/api/geocode/json?address=1600+Amphitheatre+Parkway,+Mountain+View,+CA')
  17.     resp_json_payload = response.json()
  18.     return resp_json_payload['results'][0]['geometry']['location']
  19. def authenticate():
  20.     user_email = str(input("Enter username:"))
  21.     user_pass = str(input("Enter password:"))
  22.     location = get_location()
  23.     api = pgoapi.PGoApi()
  24.     api.set_position(location["lat"],location["lng"],0.0)
  25.     if not api.login('google',user_email,user_pass,app_simulation=True):
  26.         print("Failed to login.")
  27.     req = api.create_request()
  28.     req.encounter(
  29.         encounter_id = 7,
  30.         spawn_point_id = 1,
  31.         player_latitude = float(location["lat"]),
  32.         player_longitude = float(location["lng"])
  33.     )
  34.     req.catch_pokemon(
  35.         encounter_id = 7,
  36.         pokeball = "ITEM_ULTRA_BALL",
  37.         normalized_reticle_size = 1,
  38.         spawn_point_id = 1,
  39.         hit_pokemon = True,
  40.         spin_modifier = 1,
  41.         normalized_hit_position = 1
  42.     )
  43.     req.upgrade_pokemon(
  44.         pokemon_id = 7
  45.     )
  46.     req.evolve_pokemon(
  47.         pokemon_id = 7
  48.     )
  49.     req.get_player()
  50.     req.get_inventory()
  51.     response = req.call()
  52.     print('Response dictionary:\n\r{}'.format(pprint.PrettyPrinter(indent=4).pformat(response)))
  53. authenticate()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement