Does anyone have a python example for pulling geo-tagged tweets?


#1

I’m trying to write a python script to pull geo-tagged tweets. If I can get to the part where I can run a query and get the json I’d be in pretty good shape, this is what I have so far:

import oauth2 as oauth

consumer_key="xyz"
consumer_secret="xyz"
Access_token="xyz"
Access_token_secret=“xyz”

def oauth_req(url, key, secret, http_method=“GET”,http_headers=None):
consumer = oauth.Consumer(key, secret)
token = oauth.Token(Access_token,Access_token_secret)
client = oauth.Client(consumer, token)

response, data = client.request(url)

print data

return data

search_url=“https://api.twitter.com/1.1/search/tweets.json?q=&geocode=39.95256,-75.164,2mi

home_timeline = oauth_req(search_url, consumer_key, consumer_secret)