I'm trying to collect tweets of last 7 days using Search REST API and Tweepy package in Python.
This is my code:
import tweepy
ACCESS_TOKEN = '?'
ACCESS_SECRET = '?'
CONSUMER_KEY = '?'
CONSUMER_SECRET = '?'
auth = tweepy.OAuthHandler(CONSUMER_KEY, CONSUMER_SECRET)
auth.set_access_token(ACCESS_TOKEN, ACCESS_SECRET)
api = tweepy.API(auth)
api.wait_on_rate_limit = True
api.wait_on_rate_limit_notify = True
for tweet in tweepy.Cursor(api.search, q='#newiphone OR #newappleproduct' , lang= 'en', geocode='43.8041,120.5542,20km').items():
print tweet.created_at, tweet.text, tweet.user.id , tweet.user.followers_count
My problem is that, I can get any output from this code. However, when I remove the geocode='43.8041,120.5542,20km' it gives me results that I want.
Could someone please help me how to add geolocation to the search?
The search query was correct! the problem was about tweets, there were no tweet with these specific hashtags