Rate limits remaining of Twitter API v2
See original GitHub issueHi, using Twitter API v2,
I found that we couldn’t confirm remaining of rate limits by each response with tweepy/client.py
.
Rate limits doc: https://developer.twitter.com/en/docs/twitter-api/rate-limits
So, I’d like to propose to extend tweepy/client.py
a little below.
# before
Response = namedtuple("Response", ("data", "includes", "errors", "meta"))
# after
Response = namedtuple("Response", ("data", "includes", "headers", "errors", "meta"))
And just add the headers
of requests.response
into Response
in Client._make_request
method.
Then, we can check the remaining of rate limits for each endpoint’s return value, such as response.headers['x-rate-limit-remaining']
.
I’d be grateful if you could look into that 😄
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Rate limits | Docs | Twitter Developer Platform
Twitter API v2 rate limits ; Manage follows. Follow a user, 400 successful requests per 24-hour window per user 1000 successful requests per...
Read more >What is the true rate limit for v2? - Twitter API
What is the true rate limit for v2? · 120 request per second (or is 60 the max?) · 7200 requests per hour...
Read more >node-twitter-api-v2/rate-limiting.md at master - GitHub
Plugin @twitter-api-v2/plugin-rate-limit can help you to store/get rate limit information. It stores automatically rate limits sent by Twitter at each ...
Read more >Twitter API V2 - Increase Rate Limit and Get Rate Limit Status
Direct Messages (daily): The limit is 1,000 messages sent per day. · Tweets: 2,400 per day. The daily update limit is further broken...
Read more >twitter-api-v2/plugin-rate-limit - NPM Package Overview
Rate limit plugin for twitter-api-v2. Version: 1.1.0 was published by alkihis. Start using Socket to analyze ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thank you for reply.
The use cases are, to show rate-limits for users, to prevent 429 response before API call when remaining are 0, and so on.
Official Twitter API provides a way to check rate-limits for every response, but that’s omitted now, so this lib is ideal to inherit the Twitter’s feature 😄
Oh, sorry. I’m using with commit-hash
git+https://github.com/tweepy/tweepy.git@9a28e0eaa7329918bfbf19e08afccb473210a2d1
in requirements.txt, and reviewed this lib’s code on Github.I’m interested in Twitter API v2’s arrival and this lib’s support. So, I proposed a little change. 😄