Question

I'm using the python-twitter API and whatever I pass to the below code as user, still returns my timeline and not the required user's. Is there something I'm doing wrong?

import twitter
api = twitter.Api(consumer_key=CONSUMER_KEY,
                      consumer_secret=CONSUMER_SECRET,
                      access_token_key=ACCESS_KEY,
                      access_token_secret=ACCESS_SECRET)
user = "@stackfeed"
statuses = api.GetUserTimeline(user)
print [s.text for s in statuses]

When I do not pass the required fields into twitter.Api, it gives me an authentication error.

Was it helpful?

Solution

You should use screen_name keyword argument, e.g.:

statuses = api.GetUserTimeline(screen_name="@gvanrossum")
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top