Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/305.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 使用Tweepy使用API 1.1搜索推文_Python_Search_Twitter_Tweepy - Fatal编程技术网

Python 使用Tweepy使用API 1.1搜索推文

Python 使用Tweepy使用API 1.1搜索推文,python,search,twitter,tweepy,Python,Search,Twitter,Tweepy,在过去的3个小时里,我一直试图让tweepy搜索一个sring,但没有成功。我不断得到回复,它应该使用api 1.1。我以为这已经实现了。。。因为我可以用tweepy发帖。我做错了什么 #!/usr/bin/env python import tweepy consumer_key = '***' consumer_secret = '***' access_token = '***' access_token_secret = '***' auth = tweepy.OAuthHandl

在过去的3个小时里,我一直试图让tweepy搜索一个sring,但没有成功。我不断得到回复,它应该使用api 1.1。我以为这已经实现了。。。因为我可以用tweepy发帖。我做错了什么

#!/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

升级您的
tweepy
版本:

pip install --upgrade tweepy
或者,直接从github安装:

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

仅供参考,使用
2.1
version测试您的代码-它可以工作

你能发布错误/输出,表明你没有做错什么,或者不是你想要的吗?