Fixing streaming
This commit is contained in:
parent
e18bff97d3
commit
c3e84bc8ee
10 changed files with 290 additions and 81 deletions
20
examples/stream.py
Normal file
20
examples/stream.py
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
from twython import TwythonStreamer, TwythonStreamHandler
|
||||
|
||||
|
||||
class MyHandler(TwythonStreamHandler):
|
||||
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.statuses.filter(track='twitter')
|
||||
#stream.user(track='twitter')
|
||||
#stream.site(follow='twitter')
|
||||
Loading…
Add table
Add a link
Reference in a new issue