views:

44

answers:

1

hi guys ,

Regarding the twitter API request limit, how does one counts as a request?

I'm using python-twitter, so if I have

 client = twitter.Api(username='acc',password='pw')
 self.client.GetFriends(result[0])

Does this count as 1 request? Or as many as the number of friends I have? I asked this because I have the following code:

for user in friends:
        name = user.GetScreenName()
        print 'username is ' + name
        try:             
           messages = self.client.GetUserTimeline(user= name,count = 15)
           for message in messages:
              print 'message: ' + message.getText()

And I already got a bad request error code without even displaying a single status message.

+1  A: 

That's 1 request. For that request Twitter will return a json file representing the list of friends.

Also the twitter.API call also produce a request, but this one is not counted for the limit stuff.

You can read about it in apiwiki

You can also request your limit status.

Juanjo Conti
@Juanjo, you are correct. The reason is due to the private tweets. But what I am baffled is that why python-twitter do not product an exception for accessing unauthorised tweets.
goh