Using Tweepy to search for tweets with API 1.1

£可爱£侵袭症+ 提交于 2019-12-04 10:51:19

问题


I've been trying to get tweepy to search for a sring without success for the past 3 hours. I keep getting replied it should use api 1.1. I thought that was implemented... because I can post with tweepy. What am I doing wrong?

#!/usr/bin/env python

import tweepy

consumer_key = '***'
consumer_secret = '***'
access_token = '***'
access_token_secret = '***'

auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
auth.set_access_token(access_token, access_token_secret)

api = tweepy.API(auth)


results = api.search(q="Mice")

for result in results:
    print result.text

回答1:


Upgrade your tweepy version:

pip install --upgrade tweepy

Or, install it directly from github:

git clone https://github.com/tweepy/tweepy.git
cd tweepy
python setup.py install

FYI, tested your code using 2.1 version - it works.



来源:https://stackoverflow.com/questions/18580435/using-tweepy-to-search-for-tweets-with-api-1-1

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!