Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
:Example:
Following example is the usage of the :class:`TweetStreamer` that
prints out the ID of each tweet when it is recieved. As the db is None
no storage of the tweets is performed. `api_settings` is a dictionary
of the Twitter API settings.
>>> def test(name, data, insertid):
>>> print("Inserted with ID: %s" % insertid)
>>>
>>> ts = TweetStreamer("test", "twitter", db=None, callbacks=test, **api_settings)
>>> ts.start()
"""
Thread.__init__(self)
TwythonStreamer.__init__(self, **kwargs)
self.db = db
self.name = name
self.trackstr = trackstr
self.running = True
if not type(callbacks) == list:
self.callbacks = [callbacks]
else:
self.callbacks = callbacks
def __init__(self, app_key, app_secret, oauth_token, oauth_token_secret):
self.handler = None
self.do_continue = True
TwythonStreamer.__init__(
self, app_key, app_secret, oauth_token, oauth_token_secret
)
def __init__(self, keys_dir, nlp, query):
keys_dir = pathlib.Path(keys_dir)
read = lambda fn: (keys_dir / (fn + '.txt')).open().read().strip()
api_key = map(read, ['key', 'secret', 'token', 'token_secret'])
twython.TwythonStreamer.__init__(self, *api_key)
self.nlp = nlp
self.query = query
def __init__(self, a, b, c, d, lightControl):
TwythonStreamer.__init__(self, a, b, c, d)
self.lightControl = lightControl
lightControl.tick()
def __init__(self, *kargs, **kwargs):
self.f = open('brickLaneStream.log', 'a')
TwythonStreamer.__init__(self, *kargs, **kwargs)
def on_success(self, data):