Skip to content

Instantly share code, notes, and snippets.

@yomguy
Forked from jarobins/s_twitter.py
Created September 5, 2013 06:46
Show Gist options
  • Save yomguy/6446769 to your computer and use it in GitHub Desktop.
Save yomguy/6446769 to your computer and use it in GitHub Desktop.
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