[Android] Fabric SDK has Rate Limit set to 15 for /statuses/lookup and /statuses/show


#1

Hi everyone,

I’ve tried setting up a test application for testing the new twitter sdk with fabric. I’m not interested in authenticating a user, I just render some tweets based on their ids. I used the methods provided by TweetUtils, TweetUtils.loadTweet and TweetUtils.loadTweets. The code from the onCreate method of my application class is

TwitterAuthConfig authConfig = new TwitterAuthConfig(TWITTER_KEY, TWITTER_SECRET);
    Fabric.with(new Fabric.Builder(this)
                    .kits(new TwitterCore(authConfig), new TweetUi())
                    .logger(new DefaultLogger(Log.VERBOSE))
                    .build());

The TWITTER_KEY and TWITTER_SECRET keys have been automatically generated by the Fabric plugin for Android Studio.
The problem I’m facing is that after playing a bit with the application I get the famous 429 Too Many Requests error. I dig into the internals of the android sdk, and it looks like the header values sent from twitter to retrofit say that the rate limit for lookup requests is 15, not 60! See attached image.

Does anyone know why twitter would let me perform only 15 lookup requests instead of 60, as the docs say? Are there any additional settings that I have to make?

As a note, I tried using a different set of twitter keys that I’ve got from a separate twitter application created via apps.twitter.com. When I investigated the headers received in this case, I found that the x-rate-limit-limit was 60, as the documentation says.


#2

Hey Alex,

Whenever you use TweetUtils.loadTweet and TweetUtils.loadTweets guest auth is automatically set up for you. Under guest auth, rate limits will scale with the number of users of your app.

V


#3

Hei Val,

Thanks for your reply. Could you explain us a bit how does the scaling part works? I’ve also found in the documentation that when using guest authentication, the rate limits scale with the number of users of the app. Will the rates can scale down or up as the number of users grow? Why do I have only 15 /lookup requests? (the docs say something about 60) If my application would be used by 50 or 100 users, how many /lookup requests could my application call?

Thank you very much.


Guest Authentication Rate Limits
#4

In this context, scaling means that each (new) user will be allotted the same rate limits. Let’s assume you have 100 users concurrently using your app. Using guest auth, each user will be allowed to make X calls every Y minutes. Using app auth, all users will be sharing the rate limit of X calls every Y minutes. Hope that clarifies things.

V


#5

I’m facing the same problem. Using guestLogin to request statuses/user_timeline I see in the HTTP response that my limit is of 15 requests.

Following the previous example you gave, if I have 100 concurrent users (using this guestLogin token), does this mean that each of them will be able to make 15 requests/15 min?

Moreover, if the guest authentication has the same limits as app authentication, and this is supposed to be 300… Does this mean that a particular user will only be able to make 15 requests / 15 min AND the sum of all my users requests within that 15 min window will have a limit of 300?

Thanks!


#6

if I have 100 concurrent users (using this guestLogin token), does this mean that each of them will be able to make 15 requests/15 min?

Yes

Moreover, if the guest authentication has the same limits as app authentication, and this is supposed to be 300… Does this mean that a particular user will only be able to make 15 requests / 15 min AND the sum of all my users requests within that 15 min window will have a limit of 300?

Where did you get 300?


#7

here: https://dev.twitter.com/rest/public/rate-limits
and here: https://dev.twitter.com/rest/reference/get/statuses/user_timeline

In both places it says: “300 Requests / 15-min window (app auth)”

Is this correct?


#8

OK, I see. Guest and app auth limits are not always identical, my mistake.

Moreover, if the guest authentication has the same limits as app authentication, and this is supposed to be 300… Does this mean that a particular user will only be able to make 15 requests / 15 min AND the sum of all my users requests within that 15 min window will have a limit of 300?

In this case, it will be 15 req / 15 min per user under guest auth and 300 req / 15 min for all users under app auth.


#9

Thanks for letting us know, we’ve updated the Fabric Guest Auth limits to 180 per 15 minutes per token for the following:

  • statuses/show
  • statuses/lookup
  • statuses/user_timeline
  • search/tweets

#10

Thanks for all the information provided. I’m still confused a bit after a set of tests I performed these days. I’m using the fabric sdk for Android. I tested yesterday the /statuses/lookup endpoint (via TweetUtils.loadTweets), and the retrofit headers showed that the x-rate-limit-limit was 60. This morning it was still 60 (11 AM UTC+2, 7th of may). Now I’m testing it again and it’s 180. (13 PM UTC+2)
Are these changes expected? Is it related to the previous message posted by dghubble?
Many thanks again!


#11

Hi val,

I’ve been testing this days the headers that we recieve from the twitter api, and I can’t get to see anymore the x-rate-limit-limit set to 15. I’ve been using the method from TweetUtils.loadTweets, I always get the x-rate-limit-limit to be 60, and it’s decreasing after each loadTweets call. I have tested with multiple devices and they all share the same number of requests, 60. What can I do so that all my users could get 15 lookup requests / 15 minutes window, each (not to share the req with the other users) ?
Thanks in advance.


#12