def get_data_from_db(sql, asin=None, data=None): myRedis = GetRedis().return_redis(debug_log) # 先从redis的product_info_asin中获取品牌数据 print(asin) brand = myRedis.hget('product_info_asin', 'product_info_{}'.format(asin)) print(brand) if brand: return brand print(2222) urlQ = UrlQueue(myRedis, debug_log) if type(data) is dict: result = urlQ.retrieve_asin(sql, data) else: result = urlQ.retrieve_asin(sql) return result
def get_brand_from_db(debug_log): myRedis = GetRedis().return_redis(debug_log) urlQ = UrlQueue(myRedis, debug_log) # TODO 传入一条sql语句 brand = urlQ.retrieve_asin('') return brand