fetch all tweets..

A

asit

This question is for any python-twitter developer

I want to develop an application using python twitter .

Just look at the code...

import twitter

api = twitter.Api();
sta = api.GetUserTimeline('ShashiTharoor')
i = 0
for s in sta:
i +=1
print str(i) + " " + s.text
print
print



The above code only fetches 20 tweets. How can I fetch all tweets ??
 
T

Tim Chase

This question is for any python-twitter developer

while I don't use python-twitter, I do use Andrew Price's Twyt
for my python+twitter scripting (I started to type
"python+twitter scripting needs", but "needs" is SOOOOoooo not
the right word for anything regarding twitter).
import twitter

api = twitter.Api();
sta = api.GetUserTimeline('ShashiTharoor')
i = 0
for s in sta:
i +=1
print str(i) + " " + s.text
print

The above code only fetches 20 tweets. How can I fetch all tweets ??

I believe the API limits to 200 tweets. With twyt, I can just
ask for .status_user_timeline(count=200) and get the last 200
tweets. I can also specify .status_user_timeline(count=200,
since=tweet_id) to get those since a particular tweet. Your
twitter API may have similar tools to specify the count, the
starting ID, or the "page#" like twyt does.

-tkc
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,181
Messages
2,570,970
Members
47,537
Latest member
BellCorone

Latest Threads

Top