fetch all tweets..
Tim Chase
python.list at tim.thechases.com
Sun Nov 8 18:21:23 EST 2009
> 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
More information about the Python-list
mailing list