From: Jose Asuncion Date: Fri, 6 Jul 2012 00:19:14 +0000 (-0700) Subject: streaming example X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=562e9605a140d6499aa79f504a7cfec204d8ad4d;p=tweepy.git streaming example --- 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'])