def add_task(user_info): try: global user_id global post_num global db post_num = 0 user_id = user_info[0] db = fb_sqlite_operate.fb_operate_db(user_id) logging.info("start new user:%s PID:%d", user_id, os.getpid()) web = fb_web.web_operate() web.do_login(user_info) #从网页获取群组ID和帖子ID,讲数据更新入sqlite3 if sys.argv[1] == credentials.FRENCH: googledocs_group(web) else: collect_group(web) #自动回帖操作 res = post_comments(web) if res == 0: content = "[%s]:%si\n" % (user_info[0], credentials.fb_locked_str) fb_auto_mail.write_file(content) except Exception as e: logging.error(e) finally: record_str = "[%s]:post comment number %d\n" % (user_id, post_num) logging.info("DOWN QUIT,%s", record_str) web.exit_browser() db.close_sqlite3() fb_auto_mail.write_file(record_str)
def add_task(user_info): try: global user_id global post_num global db post_num = 0 user_id = user_info[0] db = fb_sqlite_operate.fb_operate_db(user_id) logging.info("start new user:%s PID:%d", user_id,os.getpid()) web = fb_web.web_operate() web.do_login(user_info) #从网页获取群组ID和帖子ID,讲数据更新入sqlite3 if sys.argv[1] == credentials.FRENCH: googledocs_group(web) else: collect_group(web) #自动回帖操作 res = post_comments(web) if res == 0: content = "[%s]:%si\n"%(user_info[0], credentials.fb_locked_str) fb_auto_mail.write_file(content) except Exception as e: logging.error(e) finally: record_str = "[%s]:post comment number %d\n"%(user_id, post_num) logging.info("DOWN QUIT,%s", record_str) web.exit_browser() db.close_sqlite3() fb_auto_mail.write_file(record_str)
def close_limit(): try: web = fb_web.web_operate() web.do_login(credentials.CONTROL_ACCOUNT) web.add_china_tag(credentials.COMMENT_LINK) logging.info("close limit successed") except Exception as e: fb_auto_mail.write_file("add china tag error--" + credentials.COMMENT_LINK + "\n") logging.error(e) finally: web.exit_browser()