]> projects.mako.cc - twitter-api-cdsw-solutions/blobdiff - twitter-stream-raw1.py
made a collection of twitter api solutions
[twitter-api-cdsw-solutions] / twitter-stream-raw1.py
diff --git a/twitter-stream-raw1.py b/twitter-stream-raw1.py
deleted file mode 100644 (file)
index 734a59f..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-import json
-import tweepy
-from twitter_authentication import CONSUMER_KEY, CONSUMER_SECRET, ACCESS_TOKEN, ACCESS_TOKEN_SECRET
-
-auth = tweepy.OAuthHandler(CONSUMER_KEY, CONSUMER_SECRET)
-auth.set_access_token(ACCESS_TOKEN, ACCESS_TOKEN_SECRET)
-
-api = tweepy.API(auth, parser=tweepy.parsers.RawParser)
-
-@classmethod                    
-def parse(cls, api, raw):
-    status = cls.first_parse(api, raw)
-    setattr(status, 'json', json.dumps(raw))
-    return status
-
-tweepy.models.Status.first_parse = tweepy.models.Status.parse
-tweepy.models.Status.parse = parse
-
-class StreamListener(tweepy.StreamListener):
-    def on_status(self, tweet):
-        print tweet.json
-
-    def on_error(self, status_code):
-        print 'Error: ' + repr(status_code)
-        return False
-
-l = StreamListener()
-streamer = tweepy.Stream(auth=auth, listener=l)
-
-streamer.sample()

Benjamin Mako Hill || Want to submit a patch?