diegoaguilar
diegoaguilar

Reputation: 8376

How to get tweets from a user using any python library?

I'm using twitter python tools for extracting twitter information. And I'm lost when it comes to a the very simple task of getting tweets from a user.

search_results = twitter_api.search.tweets(q="", user="daguilaraguilar", count=10)
tweets = search_results['statuses']

for tweet in tweets:
    print tweet['text']

But I'm getting this error message at last of HTTP 400 response:

details: {"errors":[{"code":25,"message":"Query parameters are missing."}]}

Upvotes: 0

Views: 660

Answers (1)

Justin Poehnelt
Justin Poehnelt

Reputation: 3459

You did not define your query. According to the twitter api, it is required. Looking at the docs for the python api wrapper, I see these steps for getting the tweets of a specific user. You can probably define a since variable also according to the twitter api:

# Get your "home" timeline
t.statuses.home_timeline()

# Get a particular friend's timeline
t.statuses.friends_timeline(id="billybob")

Upvotes: 1

Related Questions