Permalink
Browse files

stream apis

  • Loading branch information...
1 parent f59e574 commit 6353ea3f471492e70310525304fe99cd38ad1d20 @bianjiang committed Dec 17, 2014
Showing with 9 additions and 12 deletions.
  1. +9 −12 tweetf0rm/twitterapi/streams.py
@@ -14,30 +14,27 @@
from twython import TwythonStreamer
import os, copy, datetime, json
-class KeywordsStreamer(TwythonStreamer):
+class Streamer(TwythonStreamer):
def __init__(self, *args, **kwargs):
"""
- Constructor with some extra params:
+ Constructor with apikeys, and output folder
-
- For other params see: TwythonStreamer
+ * apikeys: apikeys
"""
- from write_to_handler import WriteToHandler
+ logger.info(kwargs)
import copy
- self.write_to_handler = WriteToHandler(kwargs.pop('output', '.'))
- self.counter = 0
apikeys = copy.copy(kwargs.pop('apikeys', None))
-
+
if not apikeys:
- raise Exception('apikeys is missing')
- #print(kwargs)
- self.apikeys = copy.copy(apikeys) # keep a copy
+ raise MissingArgs('apikeys is missing')
+ self.apikeys = copy.copy(apikeys) # keep a copy
+
kwargs.update(apikeys)
- super(KeywordsStreamer, self).__init__(*args, **kwargs)
+ super(Streamer, self).__init__(*args, **kwargs)
def on_success(self, data):

0 comments on commit 6353ea3

Please sign in to comment.