views:

255

answers:

1

I know there's a Rest API to check the Twitter rate limit.

To summarize policy: 150 for an IP, and 150 per non-whitelisted account except for searches (which are IP only).

However, my app is using Twython, authenticated, but the limit seems to decrease for both my accounts as I use it. Example:

No authentication:

$ wget http://api.twitter.com/1/account/rate_limit_status.xml -O -
<?xml version="1.0" encoding="UTF-8"?>
<hash>
  <hourly-limit type="integer">150</hourly-limit>
  <reset-time-in-seconds type="integer">1266968961</reset-time-in-seconds>
  <reset-time type="datetime">2010-02-23T23:49:21+00:00</reset-time>
  <remaining-hits type="integer">134</remaining-hits>
</hash>

Authentication with account #1:

$ wget --user b... --password=youwish http://api.twitter.com/1/account/rate_limit_status.xml -O -
<?xml version="1.0" encoding="UTF-8"?>
<hash>
  <reset-time-in-seconds type="integer">1266968961</reset-time-in-seconds>
  <reset-time type="datetime">2010-02-23T23:49:21+00:00</reset-time>
  <remaining-hits type="integer">134</remaining-hits>
  <hourly-limit type="integer">150</hourly-limit>
</hash>

Authentication with account #2:

$ wget --user d... --password=youwish http://api.twitter.com/1/account/rate_limit_status.xml -O -
<?xml version="1.0" encoding="UTF-8"?>
<hash>
  <reset-time type="datetime">2010-02-23T23:49:21+00:00</reset-time>
  <remaining-hits type="integer">134</remaining-hits>
  <hourly-limit type="integer">150</hourly-limit>
  <reset-time-in-seconds type="integer">1266968961</reset-time-in-seconds>
</hash>

You see how both accounts seem to have exactly the same rate limit info (134/150)? I only used one account in my app, so why do both accounts show decrease?

+1  A: 

You need to set the ClientName property as being different for each call. I cut-and-pasted one of Scott Hanselmann's examples on Twitter and because the ClientName was set to TweetSandwich I was instantly given a 20,000 rate limit - so I reckon that Twitter uses the ClientName property to allocate rates rather than the authenticated user, unless the ClientName is blank when it defaults to something like IP address.

amelvin