I am a computer science student. I am interested in mining tweets for geographic data in support of my thesis .Now I could use python streaming to get the tweet(use filter). I would like to be able to use the location information of my country to get some tweets.But it was not work.Here is my code(Python). Thanks your advice.
Here is my code.
from tweepy.streaming import StreamListener
from tweepy import OAuthHandler
from tweepy import Stream
consumer_key =
consumer_secret =
access_token =
access_token_secret =
class StdOutListener(StreamListener):
""" A listener handles tweets are the received from the stream.
This is a basic listener that just prints received tweets to stdout.
"""
def on_data(self, data):
print data
return True
def on_error(self, status):
print status
if name == ‘main’:
l = StdOutListener()
auth = OAuthHandler(consumer_key, consumer_secret)
auth.set_access_token(access_token, access_token_secret)
loc = [“135.098,34.650”,“135.299,34.840”]
print access_token
stream = Stream(auth, l)
stream.filter(locations = loc)