3 from twitter_authentication import CONSUMER_KEY, CONSUMER_SECRET, ACCESS_TOKEN, ACCESS_TOKEN_SECRET
5 auth = tweepy.OAuthHandler(CONSUMER_KEY, CONSUMER_SECRET)
6 auth.set_access_token(ACCESS_TOKEN, ACCESS_TOKEN_SECRET)
8 api = tweepy.API(auth, parser=tweepy.parsers.RawParser())
11 def parse(cls, api, raw):
12 status = cls.first_parse(api, raw)
13 setattr(status, 'json', json.dumps(raw))
16 tweepy.models.Status.first_parse = tweepy.models.Status.parse
17 tweepy.models.Status.parse = parse
19 class StreamListener(tweepy.StreamListener):
20 def on_status(self, tweet):
23 def on_error(self, status_code):
24 print('Error: ' + repr(status_code))
28 streamer = tweepy.Stream(auth=auth, listener=l)