示例#1
0
def main():
    """ Retrieve and store all new tweets from the user home timeline.
    """
    # Logger
    logger = log.file_console_log()

    # Connect to the MongoDB database
    stored_tweets = db.twitter_collection()

    # Retrieve tweets from user timeline and store new ones in database
    # If any error occurs, log it in log file
    try:
        timeline_tweets = twitter.home_timeline()
    except Exception, error:
        logger.error(traceback.format_exc()[:-1])  # log error
        raise error
 def setUp(self):
     self.connection = db.connect()
     self.tweets_collection = db.twitter_collection('test_db',
                                                    'test_collection')
 def setUp(self):
     self.connection = db.connect()
     self.tweets_collection = db.twitter_collection('test_db', 'test_collection')