import random from common import mysqlutils config = { # 公司测试机器 "host": "192.168.31.223", "user": "******", "password": "******", # "db": "taobao", "db": "taobao20190813test", "charset": "utf8", "port": 6610 } # 本地数据库 db_util = mysqlutils.MysqlUtil(config_dict=config, pool_size=10) def get_cookies(): # sql = '''SELECT cookie FROM taobao_bingan WHERE state != '2.txt';''' sql = '''SELECT cookie FROM taobao_bingan WHERE state IS NULL;''' # sql = '''SELECT COUNT(*) FROM taobao_bingan WHERE state IS NULL;''' try: cookies = set() now_time = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S') result = db_util.queryall(sql) # cookie = random.choices(result)[0] # 更新获取cookie的时间 # update_get_cookie_time(now_time, cookie)
} config2 = { # 公司测试机器 "host": "192.168.31.223", "user": "******", "password": "******", # "db": "taobao", # "db": "taobao_tmp", "db": "taobao20190813test", "charset": "utf8", "port": 6610 } # 公司测试机 db_util = mysqlutils.MysqlUtil(config_dict=config, pool_size=10) # 插入阿里数据库中 db_util1 = mysqlutils.MysqlUtil(config_dict=config1, pool_size=10) db_util2 = mysqlutils.MysqlUtil(config_dict=config2, pool_size=10) def Get_Categroy_Data(): ''' 从阿里Mysql数库 获取categroy_id :return: ''' # 剔除了特殊的品类单独进行处理 # select_sql = '''SELECT id FROM taobao_item_20200110;''' select_sql = '''SELECT id FROM taobao_item_product_delete_state0115;'''