def scan_point(cell_id): """ Return pokemons in cell_id """ api = pgoapi.PGoApi() position = get_position_from_cell_id(cell_id) cell_ids = [cell_id] response_dict = api.get_map_objects(latitude=position[0], longitude=position[1], since_timestamp_ms=[0], cell_id=cell_ids) # 3. Parse output return parse_pokemons_from_response(response_dict)
def init_api(config): # instantiate pgoapi api = pgoapi.PGoApi() api.set_proxy({'http': config.proxy, 'https': config.proxy}) # new authentication initialitation if config.proxy: api.set_authentication(provider = config.auth_service, username = config.username, password = config.password, proxy_config = {'http': config.proxy, 'https': config.proxy}) else: api.set_authentication(provider = config.auth_service, username = config.username, password = config.password) # provide the path for your encrypt dll api.activate_signature("/home/ubuntu/pgoapi/libencrypt.so") return api
def main(): # log settings # log format logging.basicConfig( level=logging.DEBUG, format='%(asctime)s [%(module)10s] [%(levelname)5s] %(message)s') # log level for http request class logging.getLogger("requests").setLevel(logging.WARNING) # log level for main pgoapi class logging.getLogger("pgoapi").setLevel(logging.INFO) # log level for internal pgoapi class logging.getLogger("rpc_api").setLevel(logging.INFO) config = init_config() if not config: return if config.debug: logging.getLogger("requests").setLevel(logging.DEBUG) logging.getLogger("pgoapi").setLevel(logging.DEBUG) logging.getLogger("rpc_api").setLevel(logging.DEBUG) # instantiate pgoapi api = pgoapi.PGoApi() if config.proxy: api.set_proxy({'http': config.proxy, 'https': config.proxy}) # parse position position = util.get_pos_by_name(config.location) if not position: log.error('Your given location could not be found by name') return elif config.test: return # set player position on the earth api.set_position(*position) # new authentication initialitation if config.proxy: api.set_authentication(provider=config.auth_service, username=config.username, password=config.password, proxy_config={ 'http': config.proxy, 'https': config.proxy }) else: api.set_authentication(provider=config.auth_service, username=config.username, password=config.password) # provide the path for your encrypt dll api.activate_signature("./libencrypt.so") # print get maps object cell_ids = util.get_cell_ids(position[0], position[1]) timestamps = [ 0, ] * len(cell_ids) response_dict = api.get_map_objects(latitude=position[0], longitude=position[1], since_timestamp_ms=timestamps, cell_id=cell_ids) print('Response dictionary (get_player): \n\r{}'.format( pprint.PrettyPrinter(indent=4).pformat(response_dict)))
"Secure Password Input (if there is no password prompt, use --password <pw>):" ) config.__dict__["password"] = getpass.getpass() if config.auth_service not in ['ptc', 'google']: log.error("Invalid Auth service specified! ('ptc' or 'google')") return None return config if __name__ == "__main__": config = init_config() # instantiate pgoapi api = pgoapi.PGoApi() api.set_proxy({'http': config.proxy, 'https': config.proxy}) # new authentication initialitation if config.proxy: api.set_authentication(provider=config.auth_service, username=config.username, password=config.password, proxy_config={ 'http': config.proxy, 'https': config.proxy }) else: api.set_authentication(provider=config.auth_service, username=config.username, password=config.password)