修改了一部分报错
This commit is contained in:
+26
-20
@@ -122,8 +122,10 @@ def one_(id1, id2, num, shop_id, hd,prox, one_all_num=None):
|
||||
headers = hd_data[1]
|
||||
query = url.split("?", 1)[1]
|
||||
timestamp = int(time.time())
|
||||
timestamp_ms = int(time.time())*1000
|
||||
params = dict(re.findall(r"([^&=]+)=([^&]*)", query))
|
||||
params.update({"app_trace":params['uuid']+str(timestamp)})
|
||||
# params.update({"app_trace":params['uuid']+str(timestamp)})
|
||||
params.update({"app_trace":params['uuid']+str(timestamp_ms)})
|
||||
data = hd_data[2]
|
||||
params.update({"poi": str(shop_id)})
|
||||
params.update({"stockPois": str(shop_id)})
|
||||
@@ -171,12 +173,14 @@ def one_(id1, id2, num, shop_id, hd,prox, one_all_num=None):
|
||||
mtg_origin = eval(headers["mtgsig"])
|
||||
dfpid = mtg_origin["a3"]
|
||||
openId = headers['openId']
|
||||
# headers['mtgsig'] = get_sign_new(url1, data1, dfpid, mtg_origin)
|
||||
headers['mtgsig'] = get_sign_new1(url1, data1, dfpid, mtg_origin, openId)
|
||||
headers["Content-Length"] = str(len(data1))
|
||||
response = requests.post(url1, headers=headers, data=data1, proxies=prox, verify=False)
|
||||
# response = requests.post(url1, headers=headers, data=data1,verify=False)
|
||||
print(response.text[:])
|
||||
# input(56123)
|
||||
print(len(data1))
|
||||
input(56123)
|
||||
return response, shop_id
|
||||
|
||||
|
||||
@@ -220,12 +224,14 @@ def all_one(shop_id, workid, hd, work_queue):
|
||||
# )
|
||||
# tent2.update_data(update_sql)
|
||||
return 0
|
||||
one_price = req["data"]["contents"][0]["subModule"]["contents"][0]["lxInfo"][
|
||||
"sale_price"
|
||||
]
|
||||
if one_price == "?":
|
||||
update_headers(406, hd_id)
|
||||
return 406
|
||||
for jj in req["data"]["contents"][0]["subModule"]["contents"]:
|
||||
one_price = jj["lxInfo"].get("sale_price")
|
||||
if one_price:
|
||||
if one_price == "?":
|
||||
update_headers(406, hd_id)
|
||||
return 406
|
||||
else:
|
||||
break
|
||||
tent2.write_data_one(
|
||||
"""
|
||||
INSERT INTO category_detail_log
|
||||
@@ -314,7 +320,7 @@ def one_all(workid, hd, work_queue):
|
||||
# 拿到请求头部
|
||||
def get_hds():
|
||||
sql3 = f"""
|
||||
select id,json_data FROM elephant_headers where is_ok is null and channel = '详情' and created_at >'2026-04-14'
|
||||
select id,json_data FROM elephant_headers where is_ok is null and channel = '详情'
|
||||
"""
|
||||
da = tent3.get_shoppingmalls(sql3)
|
||||
return da
|
||||
@@ -344,7 +350,7 @@ def run_all_one(hds, workid, shop_id_list, one_ids):
|
||||
sql_all_one_pending = f"""
|
||||
select * FROM category_detail
|
||||
where one_id in ({",".join(map(str, one_ids))})
|
||||
and all_num = 0 and is_ok = 0 and now_num = 0
|
||||
and now_num = 0
|
||||
and shop_id='{shop_id}' and work_id='{workid}'
|
||||
"""
|
||||
items = tent2.get_shoppingmalls(sql_all_one_pending)
|
||||
@@ -352,11 +358,11 @@ def run_all_one(hds, workid, shop_id_list, one_ids):
|
||||
item_list.append(item)
|
||||
work_queue_allone.put(item)
|
||||
print(item_list)
|
||||
with ThreadPoolExecutor(max_workers=5) as pool:
|
||||
for hd in hds:
|
||||
pool.submit(worker_allone, 0, workid, hd, work_queue_allone)
|
||||
# for hd in hds:
|
||||
# worker_allone(0,workid,hd,work_queue_allone)
|
||||
# with ThreadPoolExecutor(max_workers=5) as pool:
|
||||
# for hd in hds:
|
||||
# pool.submit(worker_allone, 0, workid, hd, work_queue_allone)
|
||||
for hd in hds:
|
||||
worker_allone(0,workid,hd,work_queue_allone)
|
||||
|
||||
|
||||
def run_one_all(hds, workid, shop_id_list):
|
||||
@@ -393,8 +399,8 @@ SHOP_ID_LIST = [
|
||||
10001195,
|
||||
10001222,
|
||||
10001400,
|
||||
# 10001506,
|
||||
# 10001575,
|
||||
10001506,
|
||||
10001575,
|
||||
]
|
||||
SHOP_IDS_ENV = "ELEPHANT_SHOP_IDS"
|
||||
|
||||
@@ -464,9 +470,9 @@ def main():
|
||||
print(hds)
|
||||
workid = get_workid()
|
||||
shop_id_list = get_shop_id_list()
|
||||
# run_all_one(hds, workid, shop_id_list, ONE_IDS)
|
||||
run_one_all(hds, workid, shop_id_list)
|
||||
#
|
||||
run_all_one(hds, workid, shop_id_list, ONE_IDS)
|
||||
# run_one_all(hds, workid, shop_id_list)
|
||||
|
||||
if __name__ == "__main__":
|
||||
get_prox()
|
||||
# print(list(SHOP_PROX.values())[0])
|
||||
|
||||
Reference in New Issue
Block a user