pgoapi icon indicating copy to clipboard operation
pgoapi copied to clipboard

Server throttle error message

Open scottxu2018 opened this issue 9 years ago • 1 comments

I was trying to run pgoapi with error massage as below. How can I set a delay time?

Traceback (most recent call last): File "pokecli.py", line 139, in main() File "pokecli.py", line 135, in main response_dict = req.call() File "C:\Users\xxxxx\pgoapi\pgoapi\pgoapi.py", line 182, in call response = request.request(self._api_endpoint, self._req_method_list, self.g et_position()) File "C:\Users\xxxxx\pgoapi\pgoapi\rpc_api.py", line 118, in req uest raise ServerSideRequestThrottlingException("Request throttled by server... s low down man") pgoapi.exceptions.ServerSideRequestThrottlingException: Request throttled by ser ver... slow down man

scottxu2018 avatar Aug 07 '16 03:08 scottxu2018

import time and place time.sleep(1) before response_dict = req.call()

Btw. the lately added threadsafe modification:

req = api.create_request() #requests time.sleep(1) response_dict = req.call()

doesn't work well with this throttling. I suggest a shared section instead:

import threading

api_call_lock = threading.Lock()

and then

with api_call_lock: req = api.create_request() #requests time.sleep(1) response_dict = req.call()

if you're using many threads

Vigerus avatar Aug 07 '16 16:08 Vigerus