]> projects.mako.cc - twitter-api-cdsw/blobdiff - twitter-stream-raw1.py
Handle content-type header charset value for streaming API
[twitter-api-cdsw] / twitter-stream-raw1.py
index 734a59f9f16da4c3d6b78f0691cf266283bd809c..b6ea13bf321a8753ef3968924a32925bc7e4a4bf 100644 (file)
@@ -1,3 +1,4 @@
+import encoding_fix
 import json
 import tweepy
 from twitter_authentication import CONSUMER_KEY, CONSUMER_SECRET, ACCESS_TOKEN, ACCESS_TOKEN_SECRET
@@ -5,7 +6,7 @@ from twitter_authentication import CONSUMER_KEY, CONSUMER_SECRET, ACCESS_TOKEN,
 auth = tweepy.OAuthHandler(CONSUMER_KEY, CONSUMER_SECRET)
 auth.set_access_token(ACCESS_TOKEN, ACCESS_TOKEN_SECRET)
 
-api = tweepy.API(auth, parser=tweepy.parsers.RawParser)
+api = tweepy.API(auth, parser=tweepy.parsers.RawParser())
 
 @classmethod                    
 def parse(cls, api, raw):
@@ -18,10 +19,10 @@ tweepy.models.Status.parse = parse
 
 class StreamListener(tweepy.StreamListener):
     def on_status(self, tweet):
-        print tweet.json
+        print(tweet.json)
 
     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?