2

I am using python-twitter library, but I am unable to get all the timeline of a specified user.

api = twitter.Api(consumer_key='',
                      consumer_secret='',
                      access_token_key='',
                   access_token_secret='')

statuses = api.GetUserTimeline(screen_name = "me", count = 2000)
print len(statues)

always returns:

200

How can I get all timeline of one user?

Marco
  • 131
  • 1
  • 7

1 Answers1

1

from python-twitter api source code https://github.com/bear/python-twitter/blob/master/twitter/api.py :

      count (int, optional):
        Specifies the number of statuses to retrieve. May not be
        greater than 200.

You can't get more than 200 tweets with one request.

This way you retrieve the 200 last tweets. If you want to get older tweets you have to play with since_id and max_id parameters.

      since_id (int, optional):
        Returns results with an ID greater than (that is, more recent
        than) the specified ID. There are limits to the number of
        Tweets which can be accessed through the API. If the limit of
        Tweets has occurred since the since_id, the since_id will be
        forced to the oldest ID available.
      max_id (int, optional):
        Returns only statuses with an ID less than (that is, older
        than) or equal to the specified ID.
arthur
  • 2,319
  • 1
  • 17
  • 24