xdevplatform / twitter-python-ads-sdk

A Twitter supported and maintained Ads API SDK for Python.
https://twitterdev.github.io/twitter-python-ads-sdk/
MIT License
189 stars 106 forks source link

Request reached rate limit - resumes in negative seconds #280

Closed hauselin closed 2 years ago

hauselin commented 3 years ago

Hi, for some reason, recently, when I reach the request rate limit, I see messages that tell me it will resume in negative seconds. I haven't changed my code at all, and it used to work fine previously, so I'm not sure what's changed. Appreciate any help anyone can provide. Thanks!

Message

Request reached Rate Limit: resume in -830 seconds
sleep length must be non-negative

The options I'm using:

options={
            "handle_rate_limit": True,
            "retry_max": 3,
            "retry_delay": 10000,  
            "retry_on_status": [404, 500, 503],
            "retry_on_timeouts": True,
            "timeout": (1.0, 8.0),
        }
smaeda-ks commented 2 years ago

I may suspect your system clock was off for some reason: https://github.com/twitterdev/twitter-python-ads-sdk/blob/master/twitter_ads/http.py#L131-L136

hauselin commented 2 years ago

Thanks, @smaeda-ks! That's likely the issue.