From 562e9605a140d6499aa79f504a7cfec204d8ad4d Mon Sep 17 00:00:00 2001 From: Jose Asuncion Date: Thu, 5 Jul 2012 17:19:14 -0700 Subject: [PATCH] streaming example --- examples/streaming.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 examples/streaming.py diff --git a/examples/streaming.py b/examples/streaming.py new file mode 100644 index 0000000..34f6148 --- /dev/null +++ b/examples/streaming.py @@ -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']) -- 2.25.1