Search code examples
pythontwitter

Get all tweets from a user using python-twitter


I'm trying to retrieve all the tweets from a user in python with this lib.

The method provided in python-twitter to do this is defined as :

def GetUserTimeline(self,
user_id=None,
screen_name=None,
since_id=None,
max_id=None,
count=None,
include_rts=None,
trim_user=None,
exclude_replies=None):

Though if the count is limited to 200.

Documentation:

count: Specifies the number of statuses to retrieve. May not be greater than 200. [Optional]

My question now is: Is it possible to retrieve all the tweets from a user with this lib ? And is there an alternative solution ?


Solution

  • Short answer: no.

    Twitter API explicitly says that you cannot retrieve more then 200 tweets from a user per request so this is not a limitation of this particular library you're using but a limitation imposed by Twitter. But keep in mind that this is per request, if you will send multiple requests you can get up to 3200 tweets in total. But this still means that you can't get all tweets, only 3200.

    Here is official Twitter API statuses/user_timeline endpoint documentation.