return result if __name__ == '__main__': iteration_sleep_time = 5 watcher = WorkedWatcher(iteration_sleep_time * 2) log = properties.logger.getChild('main') prepare_fast_db_handler() tq = RedisTaskQueue(redis.Redis()) tq.restore_queue() load_credentials() result_queue = Queue() tasks_queue = Queue() ResultProducer(result_queue).start() ch = CredentialsHandler(refresh=True) retrievers = [] for i in xrange(properties.count_processes): rtr = RetrieverWorker(tasks_queue, process_callback, result_queue, str(i)) # rtr.daemon = True retrievers.append(rtr) rtr.start() while True:
def test_owner_screen_name(): ch = load_credentials() cid, cinfo = ch.get_credentials() api = TTR_API(cinfo) for s_elem in api.search_past("#555 OR 666 OR @777"): print s_elem.get('owner').get('screen_name')