简体   繁体   English

使用Tweepy搜索API 1.1的推文

[英]Using Tweepy to search for tweets with API 1.1

I've been trying to get tweepy to search for a sring without success for the past 3 hours. 在过去的3个小时里,我一直在努力寻找一个没有成功的sring。 I keep getting replied it should use api 1.1. 我一直在回复它应该使用api 1.1。 I thought that was implemented... because I can post with tweepy. 我认为这是实施的......因为我可以用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

Upgrade your tweepy version: 升级你的tweepy版本:

pip install --upgrade tweepy

Or, install it directly from github: 或者,直接从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. 仅供参考,使用2.1版本测试您的代码 - 它的工作原理。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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