Merge Handling into TwythonStreamer, update examples

This commit is contained in:
Mike Helmick 2013-05-03 16:57:59 -04:00
parent c3e84bc8ee
commit 97a33ce8dd
5 changed files with 94 additions and 92 deletions

View file

@ -1,19 +1,16 @@
from twython import TwythonStreamer, TwythonStreamHandler
from twython import TwythonStreamer
class MyHandler(TwythonStreamHandler):
class MyStreamer(TwythonStreamer):
def on_success(self, data):
print data
def on_error(self, status_code, data):
print status_code, data
handler = MyHandler()
# Requires Authentication as of Twitter API v1.1
stream = TwythonStreamer(APP_KEY, APP_SECRET,
OAUTH_TOKEN, OAUTH_TOKEN_SECRET,
handler)
stream = MyStreamer(APP_KEY, APP_SECRET,
OAUTH_TOKEN, OAUTH_TOKEN_SECRET)
stream.statuses.filter(track='twitter')
#stream.user(track='twitter')