def _reset_used_trackwords(self):
     last_index = len(settings.Twitter["accounts"])
     indices = range(1, last_index)
     for idx in indices:
         hashtag_key = "streamer%s:hashtags" % idx
         usermention_key = "streamer%s:usermentions" % idx
         cache = RedisCache(namespace=settings.TrackwordCache["namespace"])
         cache.delete(hashtag_key)
         cache.delete(usermention_key)            
Exemple #2
0
 def get(self):
     country = self.get_argument('code')
     segmentation = "C" + country
     cache = RedisCache(namespace=settings.RequestCache["namespace"])
     data = cache.get(segmentation)
     entitytype = self.get_argument('entitytype')
     entity = self.get_argument('entity')
     tweets = extract_tweets(data, entitytype, entity)
     self.render(
         "tweetlist.html",
         tweets=tweets
     )
 def _get_used_trackwords(self):
     used_hashtags, used_usermentions = [], []
     last_index = len(settings.Twitter["accounts"])
     indices = range(1, last_index)
     cache = RedisCache(namespace=settings.TrackwordCache["namespace"])
     for idx in indices:
         if idx == self._daemon_number:
             continue
         hashtag_key = "streamer%s:hashtags" % idx
         usermention_key = "streamer%s:usermentions" % idx
         hashtags = cache.get(hashtag_key) or []
         used_hashtags += hashtags
         usermentions = cache.get(usermention_key) or []
         used_usermentions += usermentions
     return used_hashtags, used_usermentions
Exemple #4
0
    def get(self):
        country = self.get_argument('code', 'USA')
        segmentation = "C" + country
        cache = RedisCache(namespace=settings.RequestCache["namespace"])
        data = cache.get(segmentation)
        hashtags = extract_entities(data, "ht")
        users = extract_entities(data, "um")
        tweets = extract_tweets(data, "ht", hashtags[0]['text'])
        self.render(
		    "index.html",
            page_title="Twitterlyze | Home",
		    intro="Most talked about in the last hour...",
		    footer_text="For more information, please email us at <a href=\"mailto:[email protected]\">[email protected]</a>.",
            hashtags=hashtags,
            users=users,
		    tweets=tweets,
		  )
 def _set_used_trackwords(self, hashtags, usermentions):
     hashtag_key = "streamer%s:hashtags" % self._daemon_number
     usermention_key = "streamer%s:usermentions" % self._daemon_number
     cache = RedisCache(namespace=settings.TrackwordCache["namespace"])
     cache.put(hashtag_key, hashtags)
     cache.put(usermention_key, usermentions)