geduldig / TwitterAPI

Minimal python wrapper for Twitter's REST and Streaming APIs
936 stars 263 forks source link

Way to access x-rate-limit-reset header when using TwitterPager #199

Closed aks-71 closed 3 years ago

aks-71 commented 3 years ago

Hey, I am using TwitterPager, and is there a way to access the x-rate-limit-reset header when the error status code is 429. I see that TwitterPager raises a TwitterRequestError and it only has status_code and msg. Can I get the x-rate-limit-reset header from there or anywhere else? Thanks a lot!!

Edit: I see a get_quota method in TwitterResponse but there is not way to access it from TwitterPager

geduldig commented 3 years ago

No, that's not possible.

You can get the rate limit status via a request - https://developer.twitter.com/en/docs/twitter-api/v1/developer-utilities/rate-limit-status/api-reference/get-application-rate_limit_status.

Also, you can override the default wait interval that TwitterPager uses between requests so you never get the 429 error.

aks-71 commented 3 years ago

Okay thanks!