def excute_login_task(): infos = login_info.get_login_info() # Clear all stacked login tasks before each time for login Cookies.check_login_task() log.crawler.info('The login task is starting...') for info in infos: app.send_task('tasks.login.login_task', args=(info.name, info.password), queue='login_queue', routing_key='for_login') time.sleep(10)
def excute_login_task(): infos = login_info.get_login_info() # Clear all stacked login tasks before each time for login Cookies.check_login_task() log.crawler.info('The login task is starting...') for info in infos: app.send_task('tasks.login.login_task', args=(info.name, info.password), queue='login_queue', routing_key='for_login') time.sleep(10)
def excute_login_task(): infos = login_info.get_login_info() # Clear all stacked login celery_tasks before each time for login Cookies.check_login_task() log.crawler.info('The excute_login_task is starting...') for info in infos: celery.send_task('celery_tasks.weibo.login.login_task', args=(info.name, info.password, info.source), queue='login_task', routing_key='login_task') time.sleep(10)
def excute_login_task(): infos = login_info.get_login_info() # 每次登陆前清楚所有堆积的登录任务 Cookies.check_login_task() log.crawler.info('本轮模拟登陆开始') for info in infos: app.send_task('tasks.login.login_task', args=(info.name, info.password), queue='login_queue', routing_key='for_login') time.sleep(10)
def execute_login_task(): infos = LoginInfoOper.get_login_info() # Clear all stacked login tasks before each time for login Cookies.check_login_task() crawler.info('The login task is starting...') if len(infos) <= 0: crawler.info('登陆的账号为空') for info in infos: # app.send_task('tasks.login.login_task', args=(info.name, info.password), queue='login_queue', # routing_key='for_login') login_task(info.name, info.password) time.sleep(10)
def execute_login_task(): # 获取所有的需要登录的weibo账号信息 infos = LoginInfoOper.get_login_info() # Clear all stacked login tasks before each time for login Cookies.check_login_task() crawler.info('The login task is starting...') for info in infos: # 对xx任务 发送参数args # 让这个任务启动 # queue参数:表示通过这个队列来路由通知任务 # 路由的key由参数routing_key 指定 app.send_task('tasks.login.login_task', args=(info.name, info.password), queue='login_queue', routing_key='for_login') time.sleep(10)
def excute_login_task(): infos = login_info.get_login_info() log.crawler.info('本轮模拟登陆开始') for info in infos: try: rs = Cookies.check_login_task(info.name) except KeyError: log.crawler.warning('请检查是否已经启动worker及指定了login_queue') else: if not rs: app.send_task('tasks.login.login_task', args=(info.name, info.password, info.need_verify), queue='login_queue', routing_key='for_login')