streaming example
authorJose Asuncion <jose.asuncion@gmail.com>
Fri, 6 Jul 2012 00:19:14 +0000 (17:19 -0700)
committerJose Asuncion <jose.asuncion@gmail.com>
Fri, 6 Jul 2012 00:19:14 +0000 (17:19 -0700)
examples/streaming.py [new file with mode: 0644]

diff --git a/examples/streaming.py b/examples/streaming.py
new file mode 100644 (file)
index 0000000..34f6148
--- /dev/null
@@ -0,0 +1,19 @@
+from tweepy.streaming import StreamListener
+from tweepy.auth import BasicAuthHandler
+from tweepy import Stream
+
+TWITTER_USERNAME = ''
+TWITTER_PASSWORD = ''
+
+class StdOutListener(StreamListener):
+       def on_data(self, data):
+               print data
+               return True
+
+       def on_error(self, status):
+               print status
+
+if __name__ == '__main__':
+       l = StdOutListener()
+       stream = Stream(BasicAuthHandler(TWITTER_USERNAME, TWITTER_PASSWORD), l)
+       stream.filter(track=['basketball'])