]> projects.mako.cc - twitter-api-cdsw/blobdiff - twitter-stream2.py
Updated packages and code to python3. Won't work with python 2
[twitter-api-cdsw] / twitter-stream2.py
index ce905ead89cc63880f680b6e17101ccbe830a201..8e1eee1c44f5e32f59eb194fd224fb1be3e65890 100644 (file)
@@ -8,10 +8,10 @@ api = tweepy.API(auth)
 
 class StreamListener(tweepy.StreamListener):
     def on_status(self, tweet):
-        print tweet.user.screen_name + "\t" + tweet.text
+        print(tweet.author.screen_name + "\t" + tweet.text)
 
     def on_error(self, status_code):
-        print 'Error: ' + repr(status_code)
+        print( 'Error: ' + repr(status_code))
         return False
 
 l = StreamListener()

Benjamin Mako Hill || Want to submit a patch?