Skip to content

Instantly share code, notes, and snippets.

@Crowles
Last active June 27, 2017 18:53
Show Gist options
  • Save Crowles/b33bca818233bead36e08e7aef56bec6 to your computer and use it in GitHub Desktop.
Save Crowles/b33bca818233bead36e08e7aef56bec6 to your computer and use it in GitHub Desktop.
Python Twitter stream
#!/usr/bin/env python
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)
r = api.request('statuses/filter', {'track': 'word1, word2, word3...'})
for t in r:
print("\n"+t['text']+"\n" if 'text' in t else t)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment