My aim is to extract old tweets for the entire month of Jan 2017 for New York City ('locations':'-74,40,-73,41') using python. I am able to get the live streaming tweets using the following code:
import json
import pandas as pd
import numpy as np
from TwitterAPI import TwitterAPI
#Set up the variables for the 'application'
consumerkey = 'cfKguErYawo2WB7cfNtAT2lKl'
consumersecret = 'my_consumer_secret'
access_token_key = '2195434704-Wov69oF2iIBRgUjWJhD0KThqcLApYCJXqtbYI4K'
access_token_secret = 'my_access_token_secret'
#Setup the API key
api = TwitterAPI(consumerkey,consumersecret,access_token_key,access_token_secret)
# Breaking after extracting 10 live tweets from New York City
r = api.request('statuses/filter', {'locations':'-74,40,-73,41'})
for row,item in enumerate(r):
print(row, item['text'])
if row >= 10:
break
But this is not what I am looking for. Can someone suggest how to extract the old tweets for this location filter using Twitter streaming API or any other package in python? Thanks!