Last active
October 3, 2015 07:22
-
-
Save coilysiren/20fb4676f240b859b6f4 to your computer and use it in GitHub Desktop.
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 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