简体   繁体   中英

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."}]}

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")

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM