Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GetUserTimeline always returns my own timeline

I am using python-twitter library, but I am unable to get the timeline of a specified user. Example

print [s.text for s in api.GetUserTimeline('@BarackObama')]

returns:

[u'test']

which is my last tweet (api is the object returned by tweeter.Api(...)).

Can someone help me with this?

EDIT: The complete code:

import twitter
api = twitter.Api(consumer_key='',consumer_secret='',access_token_key='',access_token_key='')
print [s.text for s in api.GetUserTimeline('BarackObama')]
like image 343
Patrick Avatar asked Sep 23 '13 16:09

Patrick


1 Answers

Try this instead (screen_name will accept @BarackObama, BarackObama or barackobama):

print [s.text for s in api.GetUserTimeline(screen_name='@BarackObama')]

(c.f. GetUserTimeline test code in twitter_test.py - which is to say that the documentation needs to be updated)

like image 168
Talvalin Avatar answered Oct 19 '22 19:10

Talvalin