Skip to content

Instantly share code, notes, and snippets.

@alfcrisci
Created March 3, 2015 10:16
Show Gist options
  • Save alfcrisci/8a8e9a5e2853c87945b8 to your computer and use it in GitHub Desktop.
Save alfcrisci/8a8e9a5e2853c87945b8 to your computer and use it in GitHub Desktop.
import io, json
from TwitterAPI import TwitterAPI
CONSUMER_KEY = ''
CONSUMER_SECRET = ''
ACCESS_TOKEN_KEY = ''
ACCESS_TOKEN_SECRET = ''
api = TwitterAPI(CONSUMER_KEY,
CONSUMER_SECRET,
ACCESS_TOKEN_KEY,
ACCESS_TOKEN_SECRET)
TRACK_TERM = 'meteo'
r = api.request('statuses/filter', {'track': TRACK_TERM})
for item in r:
file=str(item['id_str'])+'.json'
with io.open( file, 'w', encoding='utf-8') as f:
f.write(unicode(json.dumps(item, ensure_ascii=False)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment