Ejemplo n.º 1
0
def _processTwitterResults(tweets):
    """Processes and filters tweets to determine if a text should be sent.
  """
    tweet_filters = [
        filters.filterSanitizeTweets, filters.filterOldTweets,
        filters.filterRetweets
    ]

    for tweet_filter in tweet_filters:
        tweets = tweet_filter(tweets)

    delayed_tweets = filters.filterKeepDelayedTweets(tweets)

    _writeOutData(tweets, delayed_tweets)
    message = _getNotification(tweets, delayed_tweets)
    should_notify = _shouldNotify(len(tweets), len(delayed_tweets))
    return should_notify, message
Ejemplo n.º 2
0
 def testFilterKeepDelayedTweets(self):
     tweets = [{'text': 'foo delay'}, {'text': 'bar'}]
     tweets = filters.filterKeepDelayedTweets(tweets)
     self.assertEqual(tweets, [{'text': 'foo delay'}])
Ejemplo n.º 3
0
 def testFilterKeepDelayedTweets(self):
   tweets = [{'text' : 'foo delay'}, {'text' : 'bar'}]
   tweets = filters.filterKeepDelayedTweets(tweets)
   self.assertEqual(tweets, [{'text' : 'foo delay'}])