2

I am trying to access the search feature of the twitter api through a python wrapper for the api named tweepy. I have the following code:

import tweepy as t

auth = t.OAuthHandler(consumer_key,consumer_secret,access_token_key,access_token_secret)
api = t.API(auth)
api.search(q='#somepopularhashtag')

The output that I receive is an empty list as opposed to a list of twitter.status objects supposed to be returned. Could anyone help me out with this problem. I am using tweepy 2.0

anonuser0428
  • 11,789
  • 22
  • 63
  • 86

1 Answers1

3

The issue is not related to tweepy itself. Twitter has some problems with search API (basically it doesn't work) right now, see relevant issues and discussions:

See also relevant discussions on SO:

Plus, I'm not sure that tweepy migrated to twitter API 1.1 completely (see open issues on the project).

UPD:

Upgrade tweepy to the latest version directly from the github:

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

Hope that helps.

Community
  • 1
  • 1
alecxe
  • 462,703
  • 120
  • 1,088
  • 1,195
  • 1
    Well I still don't know what the issue was but I am using python-twitter another python wrapper around the twitter api. I basically created a new app as I had not used my old twitter app for a while and hence I am assuming the access_token and access_token_secret were not accepted, but the thing is that OAuth went through perfectly even with the old access_token and secret. I still have no clue what happened but like I said my solution was to switch to python-twitter and create a fresh twitter app and use the new tokens and secrets provided. – anonuser0428 Jun 06 '13 at 21:33
  • Thanks for sharing! Can you please check if tweepy now works with your new access token and secret? – alecxe Jun 07 '13 at 05:18
  • well yes Tweepy works (meaning the get_user and get_friends etc... work fine) but the search method still does not work. – anonuser0428 Jun 07 '13 at 14:32
  • 2
    @user1009091 upgrade to the latest tweepy version directly from github: `git clone https://github.com/tweepy/tweepy.git` and `python setup.py install` - should fix the search problem. Then, consider accepting the answer. Thanks. – alecxe Jun 19 '13 at 20:35