ntwitter icon indicating copy to clipboard operation
ntwitter copied to clipboard

Automatically throttle requests based on Twitter's API rate limit

Open NachoSoto opened this issue 13 years ago • 11 comments

This will delay the next call when x-rate-limit-remaining has reached 0 or when Twitter has returned 429 Too Many Requests

NachoSoto avatar Oct 09 '12 21:10 NachoSoto

Looks good.

supernayan avatar Oct 10 '12 19:10 supernayan

What happens when the rate limit is hit? Is there any way to configure a 'buffer', e.g., "rate limit when at 80%"?

martindale avatar Oct 22 '12 16:10 martindale

When the rate limit is hit (either remaining = 0 or you get a 429), it will postpone the next call for the end of the current rate-limit window. Why would you want to not use a 100% of the limit?

NachoSoto avatar Oct 22 '12 16:10 NachoSoto

Niiice! Is this all compliant with the new API rules too?

KingScooty avatar Oct 30 '12 12:10 KingScooty

What new rules are you referring to?

NachoSoto avatar Oct 30 '12 16:10 NachoSoto

How do i add the changes to my ntwitter code? The original ntwitter does not contain the rate limit code.

peterbarretto avatar Jun 08 '13 12:06 peterbarretto

You can look af my fork :)

Nacho Soto

On Sat, Jun 8, 2013 at 5:11 AM, peterbarretto [email protected] wrote:

How do i add the changes to my ntwitter code? The original ntwitter does not contain the rate limit code.

Reply to this email directly or view it on GitHub: https://github.com/AvianFlu/ntwitter/pull/77#issuecomment-19147711

NachoSoto avatar Jun 08 '13 17:06 NachoSoto

Are these api calls made as an user or as an application? Can you provide a link where the code is explained? I want to check when rate limit is reached and make calls accordingly. I am using the search api and i have 200 keywords to query every 5 minutes and get the results. So if the limit is reached i want continue with the remaining keywords in the next block or use another application token to query the remaining keywords. need some explanation of the code and i can hack or modify the code for my needs.

peterbarretto avatar Jun 13 '13 06:06 peterbarretto

if i use the current code to get a follower list it crashes after one cycle. Before the next_call() is called it crashes. As i am using forever it gives the below error: Forever detected script exited with code: 0 Forever restarting script for 1 time

The followers list is big around 100k followers so how can i get all the followers without the forever script crashing and restarting again and again?

peterbarretto avatar Jun 13 '13 11:06 peterbarretto

+1 on this, this is awesome.

martindale avatar Aug 27 '13 18:08 martindale

+1 for this. Definitely needed.

regexb avatar Sep 11 '13 03:09 regexb