Using Tweepy to search for tweets with API 1.1

user2740993 picture user2740993 · Sep 2, 2013 · Viewed 12.5k times · Source

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

Answer

alecxe picture alecxe · Sep 2, 2013

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.