Skip to content

Instantly share code, notes, and snippets.

@coilysiren
Last active October 3, 2015 07:22
Show Gist options
  • Save coilysiren/20fb4676f240b859b6f4 to your computer and use it in GitHub Desktop.
Save coilysiren/20fb4676f240b859b6f4 to your computer and use it in GitHub Desktop.
import os
import twython
import dotenv
class Streamer(twython.TwythonStreamer):
def on_sucess(self, data):
if 'text' in data:
print(data['text'].encode('utf-8'))
def on_error(self, status_code, data):
print('error status code: {}\n{}'.format(status_code, data))
dotenv.load_dotenv('.env')
stream = Streamer(
os.environ['API_KEY'],
os.environ['API_SECRET'],
os.environ['ACCESS_TOKEN'],
os.environ['ACCESS_SECRET']
)
stream.user()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment