[Answered ]-Dealing with request limit in twitter REST API

1👍

I’d say that for something like follower count, you don’t need it to be right-to-the-second up-to-date. Since each load already generates a bunch of requests (getting multiple users data), you’re better off sacrificing a little accuracy for less request generation. Store the counts you get in the page objects, perhaps along with a timestamp of when the last request was made, and then use the number from the model and only re-evaluate if it’s been more than hour since the last check. The follower count is probably not changing that drastically anyways.

UPDATE: Any time you’re working with a 3rd-party API, you should always be using mocks in development, especially with a rate limit involved. Just get the response once, save it, and then point your AJAX request to the saved copied during development.

1👍

Here’s a good method to use to find the amount of ‘remaining-hits’ you have left:
http://api.twitter.com/1/account/rate_limit_status.json

It returns something like this, letting you know when you’re allowed to make another request:

{
    "remaining_hits": 150,
    "reset_time_in_seconds": 1277234708,
    "hourly_limit": 150,
    "reset_time": "Tue Jun 22 19:25:08 +0000 2010"
}

POW

Leave a comment