当前位置: 首页>>代码示例>>Python>>正文


Python pgoapi.PGoApi方法代码示例

本文整理汇总了Python中pgoapi.PGoApi方法的典型用法代码示例。如果您正苦于以下问题:Python pgoapi.PGoApi方法的具体用法?Python pgoapi.PGoApi怎么用?Python pgoapi.PGoApi使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pgoapi的用法示例。


在下文中一共展示了pgoapi.PGoApi方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: boot

# 需要导入模块: import pgoapi [as 别名]
# 或者: from pgoapi import PGoApi [as 别名]
def boot(service_container):
    # PoGoApi parameters
    config = service_container.get('config.core')

    if os.path.isfile(os.path.join(os.getcwd(), config['load_library'])):
        config['load_library'] = os.path.join(os.getcwd(), config['load_library'])

    service_container.set_parameter('pogoapi.provider', config['login']['auth_service'])
    service_container.set_parameter('pogoapi.username', config['login']['username'])
    service_container.set_parameter('pogoapi.password', config['login']['password'])
    service_container.set_parameter('pogoapi.shared_lib', config['load_library'])

    service_container.register_singleton('pgoapi', PGoApi())
    service_container.register_singleton('google_maps', googlemaps.Client(key=config["mapping"]["gmapkey"]))

    if config['movement']['path_finder'] in ['google', 'direct']:
        service_container.set_parameter('path_finder', config['movement']['path_finder'] + '_path_finder')
    else:
        raise Exception('You must provide a valid path finder')

    if config['movement']['navigator'] in ['fort', 'waypoint', 'camper']:
        service_container.set_parameter('navigator', config['movement']['navigator'] + '_navigator')
    else:
        raise Exception('You must provide a valid navigator') 
开发者ID:tehp,项目名称:OpenPoGoBot,代码行数:26,代码来源:__init__.py

示例2: accept_tos

# 需要导入模块: import pgoapi [as 别名]
# 或者: from pgoapi import PGoApi [as 别名]
def accept_tos(username, password):
    flag = False
    while not flag:
        try:
            api = PGoApi()
            #Set spawn to NYC
            api.set_position(49.4536783, 11.077678699999979, 299.0)
            api.login('ptc', username, password)
            time.sleep(0.5)
            req = api.create_request()
            req.mark_tutorial_complete(tutorials_completed = 0, send_marketing_emails = False, send_push_notifications = False)
            response = req.call()
            print('Accepted Terms of Service for {}'.format(username))
            flag = True
        except ServerSideRequestThrottlingException:
            print('This happens, just restart') 
开发者ID:Babo96,项目名称:ptc-captcha-solver,代码行数:18,代码来源:console.py

示例3: __init__

# 需要导入模块: import pgoapi [as 别名]
# 或者: from pgoapi import PGoApi [as 别名]
def __init__(self, scan_config):
        Thread.__init__(self)
        self.daemon = True
        self.name = 'search_thread'

        self.api = PGoApi(config['SIGNATURE_LIB_PATH'])
        self.scan_config = scan_config 
开发者ID:PokeHunterProject,项目名称:pogom-linux,代码行数:9,代码来源:scan.py

示例4: api_init

# 需要导入模块: import pgoapi [as 别名]
# 或者: from pgoapi import PGoApi [as 别名]
def api_init(account):
    api = PGoApi()
    
    try:
        api.set_position(360,360,0)  
        api.set_authentication(provider = account.auth_service,\
                               username = account.username, password =  account.password)
        api.activate_signature(get_encryption_lib_path()); time.sleep(1); api.get_player()
    
    except AuthException:
        log.error('Login for %s:%s failed - wrong credentials?' % (account.username, account.password))
        return None
    
    else:
        time.sleep(1); response = api.get_inventory()
        
        if response:
            if 'status_code' in response:
                if response['status_code'] == 1 or response['status_code'] == 2: return api
                
                elif response['status_code'] == 3:
                    # try to accept ToS
                    time.sleep(5); response = api.mark_tutorial_complete(tutorials_completed = 0,\
                                    send_marketing_emails = False, send_push_notifications = False)                    

                    if response['status_code'] == 1 or response['status_code'] == 2:
                        print('Accepted TOS for %s' % account.username)
                        return api
                    
                    elif response['status_code'] == 3:
                        print('Account %s BANNED!' % account.username)
                        raise AccountBannedException; return None
                
    return None 
开发者ID:tcmaps,项目名称:fastmap,代码行数:36,代码来源:apiwrap.py

示例5: init_api

# 需要导入模块: import pgoapi [as 别名]
# 或者: from pgoapi import PGoApi [as 别名]
def init_api(self):
        self.logger.info("Initializing api...")
        self.api = PGoApi()

        self.api.login(self.config.auth, self.config.username, self.config.password, self.config.latitude,
                       self.config.longitude, 10, app_simulation=False) 
开发者ID:norecha,项目名称:PokeInventory,代码行数:8,代码来源:inventory.py

示例6: acceptTos

# 需要导入模块: import pgoapi [as 别名]
# 或者: from pgoapi import PGoApi [as 别名]
def acceptTos(username, password, pos):
	api = PGoApi()
	api.set_position(pos[0], pos[1], 0.0)

	retryCount = 0
	while True:
		try:
			api.login('ptc', username, password)
			break
		except AuthException, NotLoggedInException:
			time.sleep(0.15)
			if retryCount > 3:
				return False
			retryCount += 1
		except ServerSideRequestThrottlingException:
			time.sleep(requestSleepTimer)
			if requestSleepTimer == 5.1:
				logQueue.put(click.style('[TOS accepter] Received slow down warning. Using max delay of 5.1 already.', fg='red', bold=True))
			else:
				logQueue.put(click.style('[TOS accepter] Received slow down warning. Increasing delay from %d to %d.' % (requestSleepTimer, requestSleepTimer+0.2), fg='red', bold=True))
				requestSleepTimer += 0.2

	time.sleep(2)
	req = api.create_request()
	req.mark_tutorial_complete(tutorials_completed = 0, send_marketing_emails = False, send_push_notifications = False)
	response = req.call()
	if type(response) == dict and response['status_code'] == 1 and response['responses']['MARK_TUTORIAL_COMPLETE']['success'] == True:
		return True
	return False 
开发者ID:diksm8,项目名称:pGo-create,代码行数:31,代码来源:pgocreate.py

示例7: accept_tos_helper

# 需要导入模块: import pgoapi [as 别名]
# 或者: from pgoapi import PGoApi [as 别名]
def accept_tos_helper(username, password, location, proxy):
    print "Trying to accept Terms of Service for {}.".format(username)
    failMessage = "Maybe the HTTPS proxy is not working? {} did not accept Terms of Service.".format(username)

    api = PGoApi()
    if proxy != None:
        api.set_proxy({"https":proxy})

    location = location.replace(" ", "")
    location = location.split(",")
    api.set_position(float(location[0]), float(location[1]), 0.0)
    api.set_authentication(provider = 'ptc', username = username, password = password)
    response = api.app_simulation_login()
    if response == None:
        print "Servers do not respond to login attempt. " + failMessage
        return

    time.sleep(1)
    req = api.create_request()
    req.mark_tutorial_complete(tutorials_completed = 0, send_marketing_emails = False, send_push_notifications = False)
    response = req.call()
    if response == None:
        print "Servers do not respond to accepting the ToS. " + failMessage
        return

    print('Accepted Terms of Service for {}'.format(username)) 
开发者ID:sriyegna,项目名称:Pikaptcha,代码行数:28,代码来源:tos.py

示例8: get_token

# 需要导入模块: import pgoapi [as 别名]
# 或者: from pgoapi import PGoApi [as 别名]
def get_token(service, username, password):
    global global_token, api

    if global_token is None:
        api = PGoApi()
        if api.login(service, username, password):
            global_token = api._auth_provider._auth_token
        return global_token
    else:
        return global_token 
开发者ID:Girish-Raguvir,项目名称:PokemonGo-RedStreak,代码行数:12,代码来源:main.py

示例9: cli

# 需要导入模块: import pgoapi [as 别名]
# 或者: from pgoapi import PGoApi [as 别名]
def cli(ctx, config):
    config = Config(config or 'config.json')
    pgoapi = PGoApi()

    ctx.obj = dict(
        config=config,
        pgoapi=pgoapi
    ) 
开发者ID:pgocli,项目名称:pgocli,代码行数:10,代码来源:cli.py

示例10: __init__

# 需要导入模块: import pgoapi [as 别名]
# 或者: from pgoapi import PGoApi [as 别名]
def __init__(self, scan_config):
        Thread.__init__(self)
        self.daemon = True
        self.name = 'search_thread'

        self.api = PGoApi(config['SIGNATURE_LIB_PATH'], config['HASH_LIB_PATH'], args.key)

        self.scan_config = scan_config 
开发者ID:PokeHunterProject,项目名称:pogom-updated,代码行数:10,代码来源:scan.py

示例11: __init__

# 需要导入模块: import pgoapi [as 别名]
# 或者: from pgoapi import PGoApi [as 别名]
def __init__ (self, scan_queue=None, dispatch_queue=None):
        if scan_queue is None or dispatch_queue is None:
            raise ValueError("missing scan/dispatch queues")

        self._scan_queue = scan_queue
        self._dispatch_queue = dispatch_queue
        self._user_queue = Queue()

        self._lock = Lock()
        self._threads = []
        self._users = []

        self._signature_lib_path = ""
        if sys.platform.startswith("linux"):
            self._signature_lib_path = pub_config["pgo_api"]["linux_signature_lib_file"]
        elif sys.platform.startswith("darwin"):
            self._signature_lib_path = pub_config["pgo_api"]["darwin_signature_lib_file"]
        elif sys.platform.startswith("win"):
            self._signature_lib_path = pub_config["pgo_api"]["win_signature_lib_file"]
        else:
            raise ValueError("un-supported system")

        self._num_threads = pub_config["scanner"]["num_threads"]
        self._min_sec_before_reauth = pub_config["scanner"]["min_sec_before_reauth"]
        self._max_tries = pub_config["scanner"]["max_tries_per_request"]
        self._sleep_sec = pub_config["scanner"]["sleep_per_try_sec"]
        self._scan_throttle_sec = pub_config["scanner"]["scan_throttle_sec"]
        self._delay_between_login_sec = pub_config["scanner"]["delay_between_login_sec"]
        self._boundary = private_config["location"]

        # automatically handle IP bans by restarting/switching vpn servers
        self._restart_vpn_file = pub_config["scanner"]["restart_vpn_file"]
        self._switch_vpn_file = pub_config["scanner"]["switch_vpn_file"]
        self._max_vpn_retries_before_switch = pub_config["scanner"]["max_vpn_retries_before_switch"]
        self._delay_between_vpn_retries = pub_config["scanner"]["delay_between_vpn_retries_sec"]
        self._num_vpn_retries = 0
        self._last_vpn_retry = time.time()

        users = private_config["poke_api"]["accounts"]
        for user_data in users:
            device_info = {}
            device_info['device_id'] = uuid.uuid4().hex
            device_info['device_brand'] = "Apple"
            device_info['device_model'] = "iPhone"
            device_info['device_model_boot'] = "iPhone8,2"
            device_info['hardware_manufacturer'] = "Apple"
            device_info['hardware_model'] = "N66AP"
            device_info['firmware_brand'] = "iPhone OS"
            device_info['firmware_type'] = "9.3.3"

            user = PGoApi(device_info=device_info)
            user._last_call = 0
            user._data = user_data
            self._users.append(user)
            self._user_queue.put(user)

        self.auth_users()
        self.start_threads(self._num_threads) 
开发者ID:erasaur,项目名称:pnu,代码行数:60,代码来源:scanner.py

示例12: main

# 需要导入模块: import pgoapi [as 别名]
# 或者: from pgoapi import PGoApi [as 别名]
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)

    position = get_pos_by_name(config.location)
    if not position:
        return
        
    if config.test:
        return

    # instantiate pgoapi
    api = PGoApi()

    # provide player position on the earth
    api.set_position(*position)

    if not api.login(config.auth_service, config.username, config.password):
        return

    # chain subrequests (methods) into one RPC call

    # get player profile call
    # ----------------------
    response_dict = api.get_player()

    # apparently new dict has binary data in it, so formatting it with this method no longer works, pprint works here but there are other alternatives    
    # print('Response dictionary: \n\r{}'.format(json.dumps(response_dict, indent=2)))
    print('Response dictionary: \n\r{}'.format(pprint.PrettyPrinter(indent=4).pformat(response_dict)))
    find_poi(api, position[0], position[1]) 
开发者ID:joaoanes,项目名称:pokescan,代码行数:48,代码来源:spiral_poi_search.py


注:本文中的pgoapi.PGoApi方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。