Getting a users entire twitter timeline with tweepy

Tim Bueno picture Tim Bueno · Jul 5, 2012 · Viewed 12k times · Source

I am trying to retrieve a list that contains the entire contents of my personal twitter statuses with python and tweepy.

I have successfully authenticated via OAuth but cannot seem to recieve more than about 800 status updates from twitter. My twitter bio page says I have over 2000 tweets. I am well within the 3200 tweet limit Twitter imposes on us.

Any help would be greatly appreciated!

This is my current code (minus OAuth API authentication):

for page in tweepy.Cursor(api.user_timeline, count=200).pages(16):
    page_list.append(page)
    n = n+1
    print n

for page in page_list:
    for status in page:
       print status.text

Answer

Sam picture Sam · Jul 6, 2012

You need to specify include_rts=True as a parameter to api.user_timeline; retweets are not included by default. If you retweet a lot of things, this is likely where your missing tweets have gone.