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


Python exceptions.ServerSideRequestThrottlingException方法代码示例

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


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

示例1: accept_tos

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

示例2: start

# 需要导入模块: from pgoapi import exceptions [as 别名]
# 或者: from pgoapi.exceptions import ServerSideRequestThrottlingException [as 别名]
def start(self):
		self.login()

		while True:
			try:
				self.spin_fort()
				self.check_farming()
				if not self.farming_mode:
					self.snipe_pokemon()
					self.check_awarded_badges()
					self.inventorys.check_pokemons()

				self.check_limit()

			except (AuthException, NotLoggedInException, ServerSideRequestThrottlingException, TypeError, KeyError) as e:
				self.logger.error(e)
				self.logger.info(
					'Token Expired, wait for 20 seconds.'
				)
				time.sleep(20)
				self.login()
				continue 
开发者ID:PokemonAlpha,项目名称:AlphaBot,代码行数:24,代码来源:__init__.py

示例3: acceptTos

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

示例4: accept_tos

# 需要导入模块: from pgoapi import exceptions [as 别名]
# 或者: from pgoapi.exceptions import ServerSideRequestThrottlingException [as 别名]
def accept_tos(username, password, location, proxy):
    try:
        accept_tos_helper(username, password, location, proxy)
    except ServerSideRequestThrottlingException as e:
        print('Server side throttling, Waiting 10 seconds.')
        time.sleep(10)
        accept_tos_helper(username, password, location, proxy)
    except NotLoggedInException as e1:
        print('Could not login, Waiting for 10 seconds')
        time.sleep(10)
        accept_tos_helper(username, password, location, proxy) 
开发者ID:sriyegna,项目名称:Pikaptcha,代码行数:13,代码来源:tos.py

示例5: request

# 需要导入模块: from pgoapi import exceptions [as 别名]
# 或者: from pgoapi.exceptions import ServerSideRequestThrottlingException [as 别名]
def request(self, endpoint, subrequests, player_position):

        if not self._auth_provider or self._auth_provider.is_login() is False:
            raise NotLoggedInException()

        request_proto = self._build_main_request(subrequests, player_position)
        response = self._make_rpc(endpoint, request_proto)

        response_dict = self._parse_main_response(response, subrequests)

        self.check_authentication(response_dict)

        """ 
        some response validations 
        """
        if isinstance(response_dict, dict):
            status_code = response_dict.get('status_code', None)
            if status_code == 102:
                raise AuthTokenExpiredException()
            elif status_code == 52:
                raise ServerSideRequestThrottlingException("Request throttled by server... slow down man")
            elif status_code == 53:
                api_url = response_dict.get('api_url', None)
                if api_url is not None:
                    exception = ServerApiEndpointRedirectException()
                    exception.set_redirected_endpoint(api_url)
                    raise exception
                else: 
                    raise UnexpectedResponseException()

        return response_dict 
开发者ID:joaoanes,项目名称:pokescan,代码行数:33,代码来源:rpc_api.py


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