Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Python: Python

fetch all tweets..

 

 

Python python RSS feed   Index | Next | Previous | View Threaded


lipun4u at gmail

Nov 8, 2009, 2:46 PM

Post #1 of 2 (278 views)
Permalink
fetch all tweets..

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 ??
--
http://mail.python.org/mailman/listinfo/python-list


python.list at tim

Nov 8, 2009, 3:21 PM

Post #2 of 2 (257 views)
Permalink
Re: fetch all tweets.. [In reply to]

> 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



--
http://mail.python.org/mailman/listinfo/python-list

Python python RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.