Created
August 25, 2013 12:21
-
-
Save jarobins/6333575 to your computer and use it in GitHub Desktop.
Twitter Stream
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
import requests | |
from requests_oauthlib import OAuth1 | |
consumer_key='key' | |
consumer_secret='secret' | |
access_token_key='t_key' | |
access_token_secret='t_secret' | |
auth = OAuth1(consumer_key, consumer_secret, | |
access_token_key, access_token_secret) | |
r = requests.get('https://stream.twitter.com/1.1/statuses/sample.json', | |
stream=True, auth=auth) | |
for line in r.iter_lines(): | |
# filter out keep-alive new lines | |
if line: | |
print json.loads(line) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment