Esempio n. 1
0
 def __init__(self, app_key, app_secret, oauth_token, oauth_token_secret, start_time, maxsecs, lang):
     TwythonStreamer.__init__(self, app_key, app_secret, oauth_token, oauth_token_secret)
     self.userinfo = {}   
     self.start_time = start_time
     self.maxsecs = maxsecs
     self.lang = lang
     print "initialized"
Esempio n. 2
0
    def __init__(self, source):
        """

        :param source: Lista de Enumerdados que indican la fuente del tweet en la configuración del streamer.
        Esto puede ser por follow accounts, track terms o bounding box
        :return:
        """

        self.name = 'twitter_streamer'
        self.count = 0

        # Logger
        streamer_logging.init_logger(root_name=LOGGING_ROOT_NAME,
                                     level='DEBUG',
                                     log_base_path=LOGGING_BASE_PATH)
        self.module_logger = logging.getLogger(LOGGING_ROOT_NAME + '.streamer')
        self.module_logger.info("Starting twitter streamer...")

        TwythonStreamer.__init__(
            self, TWITTER_ACCESS_KEYS["app_key"],
            TWITTER_ACCESS_KEYS["app_secret"],
            TWITTER_ACCESS_KEYS["app_access_token"],
            TWITTER_ACCESS_KEYS["app_access_token_secret"])
        self.queue = Queue()
        self.workers = []
        for i in range(CANT_WORKERS):
            worker = Thread(target=process_twitter_data,
                            args=(i, self.queue, self.name, source))
            worker.setDaemon(True)
            worker.start()
            self.workers.append(worker)
Esempio n. 3
0
 def __init__(self,
              app_key,
              app_secret,
              oauth_token,
              oauth_token_secret,
              timeout=300,
              retry_count=None,
              retry_in=10,
              client_args=None,
              handlers=None,
              chunk_size=1,
              parent=None):
     self.db = parent.db
     self.parent = parent
     TwythonStreamer.__init__(self,
                              app_key,
                              app_secret,
                              oauth_token,
                              oauth_token_secret,
                              timeout=480,
                              retry_count=0,
                              retry_in=60,
                              client_args=None,
                              handlers=None,
                              chunk_size=1)
     self.muted_users = self.db.settings["muted_users"]
Esempio n. 4
0
    def __init__(self):
        # Load credentials from json file
        with open("twitter/twitter_credentials.json", "r") as file:
            creds = json.load(file)
            TwythonStreamer.__init__(self, creds['CONSUMER_KEY'], creds['CONSUMER_SECRET'], creds['ACCESS_TOKEN'], creds['ACCESS_SECRET'])

        self.tweet_producer = Producer()
    def __init__(self, rabbit_host, rabbit_port, app_key, app_secret,
                 oauth_token, oauth_token_secret, tag):
        """Create a new instance of the sampleStreamer class that will connect to Twitter API and send tweets
        to rabbitmq queue using pika module.
        :param str app_key, app_secret, oauth_token, oauth_token_secret: credentials for Twitter API authentication
        :param str tag: a tag that will be added to the tweet body to indicate its collection method

        """
        self.rabbit_host = rabbit_host
        self.rabbit_port = rabbit_port
        self.rabbit_client = self.open_rabbit_connection()
        self.tweets_queue = self.open_rabbit_channel()
        if PROXY:
            client_args = {'proxies': PROXY}
        else:
            client_args = {}
        self.do_continue = True
        TwythonStreamer.__init__(self,
                                 app_key,
                                 app_secret,
                                 oauth_token,
                                 oauth_token_secret,
                                 timeout=100,
                                 chunk_size=200,
                                 client_args=client_args)
        self.tag = tag
Esempio n. 6
0
    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
        )
Esempio n. 7
0
    def __init__(self, tweetAddedQueue, limitNoticeQueue, locations, *args, **kwargs):
        TwythonStreamer.__init__(self, *args, **kwargs)
        self.tweetAddedQueue = tweetAddedQueue
        self.limitNoticeQueue = limitNoticeQueue
        self.locations = locations

        self.statuses.filter(locations = self.locations)
Esempio n. 8
0
 def __init__(self,APP_KEY, APP_SECRET,
                 OAUTH_TOKEN, OAUTH_TOKEN_SECRET):
     TwythonStreamer.__init__(self,APP_KEY, APP_SECRET,OAUTH_TOKEN, OAUTH_TOKEN_SECRET)
     #self.tweets = mg.MongoClient().eleicoes.twitter
     #self.users = mg.MongoClient().eleicoes.users
     #self.users.ensure_index('id_str',unique=True)
     self.f = open('FakeNews.json', 'a+')
Esempio n. 9
0
    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
        )
Esempio n. 10
0
 def __init__(self):
     import threading
     TwythonStreamer.__init__(self, TweetStreamer.CONSUMER_KEY,
                              TweetStreamer.CONSUMER_SECRET,
                              TweetStreamer.ACCESS_TOKEN,
                              TweetStreamer.ACCESS_KEY)
     self.tweets = []
     self.stop = False
Esempio n. 11
0
    def __init__(self, tweetAddedQueue, limitNoticeQueue, locations, *args,
                 **kwargs):
        TwythonStreamer.__init__(self, *args, **kwargs)
        self.tweetAddedQueue = tweetAddedQueue
        self.limitNoticeQueue = limitNoticeQueue
        self.locations = locations

        self.statuses.filter(locations=self.locations)
Esempio n. 12
0
 def __init__(self, plugin, app_key, app_secret, oauth_token, oauth_token_secret):
     self.plugin = plugin
     self.app_key = app_key
     self.app_secret = app_secret
     self.oauth_token = oauth_token
     self.oauth_token_secret = oauth_token_secret
     TwythonStreamer.__init__(self, self.app_key, self.app_secret, self.oauth_token, self.oauth_token_secret)
     self.twitter_api = Twython(self.app_key, self.app_secret, self.oauth_token, self.oauth_token_secret)
	def __init__(self,conn,app_key, app_secret, oauth_token, oauth_token_secret,queryText='',long='',lat='',Radius=''):
		TwythonStreamer.__init__(self,app_key, app_secret, oauth_token, oauth_token_secret)
		self.queryText = queryText
		self.long = long
		self.lat = lat
		self.Radius = Radius
		self.conn = conn
		self.cursor = conn.cursor()
Esempio n. 14
0
 def __init__(self, app_key, app_secret, oauth_token, oauth_token_secret,
              start_time, maxsecs):
     TwythonStreamer.__init__(self, app_key, app_secret, oauth_token,
                              oauth_token_secret)
     self.userinfo = {}
     self.start_time = start_time
     self.maxsecs = maxsecs
     print "initialized"
Esempio n. 15
0
 def __init__(self, parent, app_key, app_secret, oauth_token, 
                 oauth_token_secret, timeout=300, retry_count=None, 
                 retry_in=10, client_args=None, handlers=None, 
                 chunk_size=1):
     TwythonStreamer.__init__(self, app_key, app_secret, oauth_token, 
                 oauth_token_secret, timeout=300, retry_count=None, 
                 retry_in=10, client_args=None, handlers=None, 
                 chunk_size=1)
     self.parent = parent
Esempio n. 16
0
 def __init__ (self, config):
     self.config = config
     TwythonStreamer.__init__(self,
         self.config['twitter']['appkeys']['app_key'],
         self.config['twitter']['appkeys']['app_secret'],
         self.config['twitter']['appkeys']['oauth_token'],
         self.config['twitter']['appkeys']['oauth_token_secret'])
     self.db_cursor = DBCursor(self.config['database'])
     self.username_only = True;
Esempio n. 17
0
 def __init__(self, *args, **kwargs):
     TwythonStreamer.__init__(self, *args, **streamer_config(kwargs))
     self.counter = 0
     self.count_limit = 0
     self.error_counter = 0
     self.error_limit = 1000
     self.users = set()
     self.keywords = set()
     self.receive_tweet = print_tweet_json
Esempio n. 18
0
 def __init__(self, parent, commands, app_key, app_secret, oauth_token, 
                 oauth_token_secret, debug=0, timeout=300, retry_count=None,
                 retry_in=10, client_args=None, handlers=None, chunk_size=1):
     TwythonStreamer.__init__(self, app_key, app_secret, oauth_token, 
                 oauth_token_secret, timeout=300, retry_count=None, 
                 retry_in=10, client_args=None, handlers=None, 
                 chunk_size=1)
     self.parent = parent
     self.cmd_list = commands
     self.debug = debug
Esempio n. 19
0
 def __init__(self, app_key, app_secret, oauth_token, oauth_token_secret,
              start_time, maxsecs, lang, trackterm):
     TwythonStreamer.__init__(self, app_key, app_secret, oauth_token,
                              oauth_token_secret)
     self.userinfo = {}
     self.start_time = start_time
     self.maxsecs = maxsecs
     self.lang = lang
     self.trackterm = trackterm
     print "initialized"
Esempio n. 20
0
    def __init__(self, **kw):

        TwythonStreamer.__init__(
            self, kw.get('app_key', credentials.TWT_API_KEY),
            kw.get('app_secret', credentials.TWT_API_SECRET),
            kw.get('oauth_token', credentials.TWT_ACCESS_TOKEN),
            kw.get('oauth_token_secret', credentials.TWT_ACCESS_SECRET))
        self.parse = kw.get('parse', parse_tweet)
        self.store = kw.get('store', _print)
        self.error = kw.get('error', _pass)
Esempio n. 21
0
    def __init__(self, flag, app_key, app_secret, oauth_token, oauth_token_secret, led_list, terms):
        self.led_list = led_list
        self.flag = flag
        self.brightness = 0

        thread = threading.Thread(target=self.tick)
        thread.start()

        TwythonStreamer.__init__(self, app_key, app_secret, oauth_token, oauth_token_secret)
        self.statuses.filter(track=terms)
 def __init__(self, *args, **kwargs):
     TwythonStreamer.__init__(self, *args, **kwargs)
     self.output_tweets = 'stream_tweets2.json'
     self.output_incidents = 'stream_incidents2.json'
     self.counter = 0
     self.count_limit = 1000000
     self.error_counter = 0
     self.error_limit = 1000
     self.follow = deque(maxlen=5000)
     self.tweets = self.load_tweets()
     self.incidents = self.load_incidents()
Esempio n. 23
0
    def __init__(self, name, trackstr, db=None, callbacks=None, **kwargs):
        """
        Creates the TweetStreamer. This streamer collects tweets from the
        Twitter API and stores them in a MongoDB. Can also callback to functions.

        :param name: An indentifier for the collection.
        :type name: str
        :param trackstr: Search string for the twitter API.
        :type trackstr: str
        :param db: The MongoDB collection to put the tweet in. If this
            parameter is left as `None`, no database will be written to,
            instead only the `on_add` function will be called *(optional)*.
        :param callbacks: Functions called when a tweet is recieved.
            Can also be a list of functions which will all be called.
            Will pass three arguments (name, data, insert_id) being the
            collection name, tweet data and mongo insert id respectively
            into the function *(optional)*.
        :param **kwargs: Settings for the Twitter API. Suggested example
            arguments:

                * `app_key`
                * `app_secret`
                * `oauth_token`
                * `oauth_token_secret`

            (for more information see the :class:`twython.TwythonStreamer`
            documentation)

        :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, escritores):
        self.authorizator = GetAuthorizations(1000)
        self.tipo_id = 100
        self.authorizator.load_twitter_token(self.tipo_id)
        app_key, app_secret, oauth_token, oauth_token_secret = self.authorizator.get_twitter_secret(
        )

        Recolector.__init__(self, escritores)
        TwythonStreamer.__init__(self, app_key, app_secret, oauth_token,
                                 oauth_token_secret)

        self.tweets = []
Esempio n. 25
0
    def __init__(self, name, trackstr, db=None, callbacks=None, **kwargs):
        """
        Creates the TweetStreamer. This streamer collects tweets from the
        Twitter API and stores them in a MongoDB. Can also callback to functions.

        :param name: An indentifier for the collection.
        :type name: str
        :param trackstr: Search string for the twitter API.
        :type trackstr: str
        :param db: The MongoDB collection to put the tweet in. If this
            parameter is left as `None`, no database will be written to,
            instead only the `on_add` function will be called *(optional)*.
        :param callbacks: Functions called when a tweet is recieved.
            Can also be a list of functions which will all be called.
            Will pass three arguments (name, data, insert_id) being the
            collection name, tweet data and mongo insert id respectively
            into the function *(optional)*.
        :param **kwargs: Settings for the Twitter API. Suggested example
            arguments:

                * `app_key`
                * `app_secret`
                * `oauth_token`
                * `oauth_token_secret`

            (for more information see the :class:`twython.TwythonStreamer`
            documentation)

        :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
Esempio n. 26
0
 def __init__(self, **kw):
   
   TwythonStreamer.__init__(
     self,
     kw.get('app_key', credentials.TWT_API_KEY),
     kw.get('app_secret', credentials.TWT_API_SECRET),
     kw.get('oauth_token', credentials.TWT_ACCESS_TOKEN),
     kw.get('oauth_token_secret', credentials.TWT_ACCESS_SECRET)
     )
   self.parse = kw.get('parse', parse_tweet)
   self.store = kw.get('store', _print)
   self.error = kw.get('error', _pass)
Esempio n. 27
0
    def __init__(self, tweet_queue, hashtag_queue):
        TwythonStreamer.__init__(self, APP_KEY, APP_SECRET, OAUTH_TOKEN, OAUTH_TOKEN_SECRET)
        self.tweet_queue = tweet_queue
        self.q = hashtag_queue
        self.hashtag_map = {}

        self.r_server = redis.Redis('localhost')
        try:
            self.r_server.get('something') # try to use redis to see if its available
            self.redis = True
        except redis.exceptions.ConnectionError:
            print('WARNING: Redis server not running. App will run in in-memory mode')
            self.redis = False
Esempio n. 28
0
    def __init__(self, app_key, app_secret, oauth_token, oauth_token_secret,filedir,filebreak):

        filename=filedir + time.strftime("%Y-%m-%dT%H_%M_%S", time.gmtime()) +".json"
        self.handler = None
        self.oauth_token = oauth_token
        self.filedir = filedir
        self.counter = 0
        self.do_continue = True
        self.outputfile =  open(filename,"a+",encoding='utf-8')
        self.filebreak = filebreak
        self.tweets = []
        TwythonStreamer.__init__(self, app_key, app_secret, oauth_token,
                                 oauth_token_secret)
Esempio n. 29
0
 def __init__(self, **kwargs):
   
   TwythonStreamer.__init__(
     self,
     kwargs.get('api_key'),
     kwargs.get('api_secret'),
     kwargs.get('access_token'),
     kwargs.get('access_secret')
     )
   self.controller = Controller(
     org_id = 'public',
     source_type = 'twitter'
     )
   self._table = db['twitter']
   self.func = kwargs.get('func', _twp.parse)
    def __init__(self, oauth_keys, psql_conn):
        self.oauth_keys = oauth_keys
        self.psql_connection = psql_conn

        keys_to_use_index = random.randint(0, len(oauth_keys)-1)
        print "Connecting with keys: " + str(keys_to_use_index)
        keys_to_use = oauth_keys[keys_to_use_index]
        TwythonStreamer.__init__(self,
            keys_to_use['consumer_key'], keys_to_use['consumer_secret'],
            keys_to_use['access_token_key'], keys_to_use['access_token_secret'])
        
        self.psql_cursor = self.psql_connection.cursor()
        self.psql_table = 'pgh311'
        
        psycopg2.extras.register_hstore(self.psql_connection)
    def __init__(self, oauth_keys, psql_conn, city_name):
        self.oauth_keys = oauth_keys
        self.psql_connection = psql_conn
        self.city_name = city_name

        keys_to_use_index = random.randint(0, len(oauth_keys)-1)
        print "Connecting with keys: " + str(keys_to_use_index)
        keys_to_use = oauth_keys[keys_to_use_index]
        TwythonStreamer.__init__(self,
            keys_to_use['consumer_key'], keys_to_use['consumer_secret'],
            keys_to_use['access_token_key'], keys_to_use['access_token_secret'])
        
        self.psql_cursor = self.psql_connection.cursor()
        self.psql_table = 'tweet_' + city_name
        psycopg2.extras.register_hstore(self.psql_connection)
        self.min_lon, self.min_lat, self.max_lon, self.max_lat =\
            [float(s.strip()) for s in utils.CITY_LOCATIONS[city_name]['locations'].split(',')]
    def __init__(self, oauth_keys, psql_conn, city_name):
        self.oauth_keys = oauth_keys
        self.psql_connection = psql_conn
        self.city_name = city_name

        keys_to_use_index = random.randint(0, len(oauth_keys)-1)
        print "Connecting with keys: " + str(keys_to_use_index)
        keys_to_use = oauth_keys[keys_to_use_index]
        TwythonStreamer.__init__(self,
            keys_to_use['consumer_key'], keys_to_use['consumer_secret'],
            keys_to_use['access_token_key'], keys_to_use['access_token_secret'])
        
        self.psql_cursor = self.psql_connection.cursor()
        self.psql_table = 'tweet_' + city_name
        psycopg2.extras.register_hstore(self.psql_connection)
        self.min_lon, self.min_lat, self.max_lon, self.max_lat =\
            [float(s.strip()) for s in utils.CITY_LOCATIONS[city_name]['locations'].split(',')]
Esempio n. 33
0
    def __init__(self, tweet_queue, hashtag_queue):
        TwythonStreamer.__init__(self, APP_KEY, APP_SECRET, OAUTH_TOKEN,
                                 OAUTH_TOKEN_SECRET)
        self.tweet_queue = tweet_queue
        self.q = hashtag_queue
        self.hashtag_map = {}

        self.r_server = redis.Redis('localhost')
        try:
            self.r_server.get(
                'something')  # try to use redis to see if its available
            self.redis = True
        except redis.exceptions.ConnectionError:
            print(
                'WARNING: Redis server not running. App will run in in-memory mode'
            )
            self.redis = False
Esempio n. 34
0
 def __init__(self, q, msgq, log, countq, ssid, credentials, chunk_size=10):
     TwythonStreamer.__init__(self,
                              credentials['APP_KEY'],
                              credentials['APP_SECRET'],
                              credentials['ACCESS_KEY'],
                              credentials['ACCESS_SECRET'],
                              handlers=['delete',
                                        'scrub_geo',
                                        'limit',
                                        'status_withheld',
                                        'disconnect',
                                        'warning'],
                              chunk_size=chunk_size)
     self.queue = q
     self.msgq = msgq
     self.log = log
     self.countq = countq
     self.streamsession_id = ssid
  def __init__(self):
    self.name = 'tweets_collector'
    self.count = 1
    # logger
    self.logger = logging.getLogger(self.name)
    self.logger.debug('Initializing module.')
    # Twython
    app_key = ''
    app_secret = ''
    access_token = ''
    access_token_secret = ''

    #add handlers
    for sig in [signal.SIGTERM, signal.SIGINT, signal.SIGQUIT]:  #signal.SIGHUP no importa si se cierra la terminal
      signal.signal(sig, self.handler)

    #self.rest_twitter = Twython(self.appkeys.api_key.app_key, access_token=self.appkeys.access_token)
    TwythonStreamer.__init__(self, app_key, app_secret, access_token, access_token_secret)
 def __init__(self, oauth_keys, psql_conn, note, skip):
     self.oauth_keys = oauth_keys
     self.psql_connection = psql_conn
     self.counter = 0
     self.skip = skip
     self.note = note
     self.bypass = False
     self.totalTweets = 0
     keys_to_use_index = random.randint(0, len(oauth_keys)-1)
     logger.warning("Connecting with keys: " + str(keys_to_use_index))
     keys_to_use = oauth_keys[keys_to_use_index]
     TwythonStreamer.__init__(self,
         keys_to_use['consumer_key'], keys_to_use['consumer_secret'],
         keys_to_use['access_token_key'], keys_to_use['access_token_secret'])
     
     self.psql_cursor = self.psql_connection.cursor()
     self.psql_table = table
     
     psycopg2.extras.register_hstore(self.psql_connection)
Esempio n. 37
0
    def __init__(self, oauth_keys, psql_conn, note, skip):
        self.oauth_keys = oauth_keys
        self.psql_connection = psql_conn
        self.counter = 0
        self.skip = skip
        self.note = note
        self.bypass = False
        self.totalTweets = 0
        keys_to_use_index = random.randint(0, len(oauth_keys) - 1)
        logger.warning("Connecting with keys: " + str(keys_to_use_index))
        keys_to_use = oauth_keys[keys_to_use_index]
        TwythonStreamer.__init__(self, keys_to_use['consumer_key'],
                                 keys_to_use['consumer_secret'],
                                 keys_to_use['access_token_key'],
                                 keys_to_use['access_token_secret'])

        self.psql_cursor = self.psql_connection.cursor()
        self.psql_table = table

        psycopg2.extras.register_hstore(self.psql_connection)
Esempio n. 38
0
 def __init__(self, settings_file: str = '../res/twitter_api_credentials.json',
              feature_data=None,
              database_interface=None,
              message_pipes=None):
     with open(settings_file, 'r', encoding='utf-8') as settings_data:
         settings = load(settings_data)
         # twitter api settings
         self.CONSUMER_KEY = settings['CONSUMER_KEY']
         self.CONSUMER_SECRET = settings['CONSUMER_SECRET']
         self.ACCESS_TOKEN = settings['ACCESS_TOKEN']
         self.ACCESS_SECRET = settings['ACCESS_SECRET']
     ConnectedProcess.__init__(self, name='Twitter Firehose', database_interface=database_interface,
                               message_pipes=message_pipes)
     TwythonStreamer.__init__(self, app_key=self.CONSUMER_KEY, app_secret=self.CONSUMER_SECRET,
                              oauth_token=self.ACCESS_TOKEN,
                              oauth_token_secret=self.ACCESS_SECRET)
     self.count = 0
     self.database_interface = database_interface
     self.analyzer = SentimentIntensityAnalyzer()
     self.feature_data = feature_data
     self.tracking_features = ', '.join([feature for feature in feature_data.values()])
     self.tweet_time_slice = {table_name: [] for table_name in feature_data.keys()}
Esempio n. 39
0
 def __init__(self, keys=consts.keys,me='exumbra_insoIem',logging=True):
     auth = [
         keys['app']['api_key'],
         keys['app']['api_secret'],
         keys['user']['access_token'],
         keys['user']['access_token_secret'],
     ]
     self.api = Twython(*auth)
     # self.api.update_status(status="tst3")
     
     self.streamer = TwythonStreamer(*auth)
     self.streamer.on_success = self.on_stream_success
     self.streamer.on_error = self.on_error
     self.me = me
     self.app_name = "twitbutler"
     self.logging = logging
Esempio n. 40
0
 def __init__(self, a, b, c, d, lightControl):
     TwythonStreamer.__init__(self, a, b, c, d)
     self.lightControl = lightControl
     lightControl.tick()
Esempio n. 41
0
 def __init__(self, consumer_key, consumer_secret, access_token,
              access_token_secret, twitter_instance):
     self.twitter = twitter_instance
     TwythonStreamer.__init__(self, consumer_key, consumer_secret,
                              access_token, access_token_secret)
Esempio n. 42
0
 def __init__(self,APP_KEY, APP_SECRET, OAUTH_TOKEN, OAUTH_TOKEN_SECRET,sqs):
     self.sqs=sqs
     TwythonStreamer.__init__(self,APP_KEY, APP_SECRET, OAUTH_TOKEN, OAUTH_TOKEN_SECRET)
Esempio n. 43
0
    def __init__(self, *a, **kwargs):

        # Create a Borrow instance
        self._stock_loan = Borrow(database_name='stock_loan', create_new=False)

        TwythonStreamer.__init__(self, *a, **kwargs)
Esempio n. 44
0
 def __init__(self, app_key, app_secret, oauth_token, oauth_token_secret, timeout=300, retry_count=None, retry_in=10, client_args=None, handlers=None, chunk_size=1, parent=None):
  self.db = parent.db
  self.parent = parent
  TwythonStreamer.__init__(self, app_key, app_secret, oauth_token, oauth_token_secret, timeout=480, retry_count=0, retry_in=60, client_args=None, handlers=None, chunk_size=1)
  self.muted_users = self.db.settings["muted_users"]
Esempio n. 45
0
def get_stream_instance():
    app_key, app_secret, oauth_token, oauth_token_secret = get_twitter_creds()
    return TwythonStreamer(app_key, app_secret, oauth_token,
                           oauth_token_secret)
Esempio n. 46
0
    def __init__(self, *a, **kwargs):

        # Create a Borrow instance
        self._stock_loan = Borrow(database_name='stock_loan', create_new=False)

        TwythonStreamer.__init__(self, *a, **kwargs)
Esempio n. 47
0
 def __init__(self):
     TwythonStreamer.__init__(self, consumer_key, consumer_secret,
                              access_token, access_token_secret)
     self.tweet_list = []
     self.maxcount = max_tweets
     self.count = 1
 def __init__(self, *args, **kwargs):
     TwythonStreamer.__init__(self, *args, **kwargs)
     print("Initialized TwitterStreamer.")
     self.queue = gevent.queue.Queue()
Esempio n. 49
0
 def __init__(self):
     import threading
     TwythonStreamer.__init__(self, TweetStreamer.CONSUMER_KEY, TweetStreamer.CONSUMER_SECRET, TweetStreamer.ACCESS_TOKEN, TweetStreamer.ACCESS_KEY)
     self.tweets = []
     self.stop = False
     print "stream created %s" % id(self)
Esempio n. 50
0
 def __init__(self):
     TwythonStreamer.__init__(self, *get_connection_info())
     self.counter = 0
 def __init__(self, *args, **kwargs):
     TwythonStreamer.__init__(self, *args, **kwargs)
     print("Initialized TwitterStreamer.")
     self.queue = gevent.queue.Queue()
Esempio n. 52
0
 def __init__(self, *args, **kwargs):
     TwythonStreamer.__init__(self, *args, **kwargs)
     print('INIT '*10)
     self.queue = gevent.queue.Queue()
Esempio n. 53
0
 def __init__(self, *options):
     TwythonStreamer.__init__(self, *options)
     self.run()
Esempio n. 54
0
 def __init__(self, consumer_key, consumer_secret, access_token,
              access_token_secret, zmq_pub_string):
     TwythonStreamer.__init__(self, consumer_key, consumer_secret,
                              access_token, access_token_secret)
     BasePublisher.__init__(self, zmq_pub_string, 'tweet.stream')
Esempio n. 55
0
 def __init__(self, *args, **kwargs):
   self.redis = redis_init()
   self.wordApi = wordnik_init()
   TwythonStreamer.__init__(self, *args, **kwargs)
Esempio n. 56
0
 def __init__(self, c_key, c_secret, a_key, a_secret):
     TwythonStreamer.__init__(self, c_key, c_secret, a_key, a_secret)
     self.i = 0
Esempio n. 57
0
 def __init__(self, app_key, app_secret, oauth_token, oauth_token_secret):
   TwythonStreamer.__init__(self, app_key, app_secret, oauth_token, oauth_token_secret)
Esempio n. 58
0
 def __init__(self, *args, **kwargs):
     TwythonStreamer.__init__(self, *args, **kwargs)
     with open("stopwords.txt") as f:
         self.stopwords = set(map(lambda x: x.strip(), f.readlines()))
     self.trendis = Trendis(namespace="twitter")