def in_work():
response_work = requests.get(url + param + work, verify=False)
response_work.encoding = "utf-8"
data_work = response_work.json()
print(url + param + work)
for x in data_work:
for y in x["positions"]:
numb_Zap = y["comment"][-9:]
acc = y["comment"][0:10]
if acc in ["0000000000"]:
if y["statusCode"] in ["27047"]:
with open("tbl.json", "r") as rf:
data_old = json.load(rf)
for d in data_old:
for z in d["orders"]:
internal_numb = z["numb_order"]
status_old = z["status_order"]
if internal_numb in y["comment"][-9:]:
if status_old == y["statusCode"]:
print("Уже есть в списке")
else:
Change_w = requests.get(url1 + numb_Zap + '&response=' + y["commentAnswer"] + str(x["sum"]), verify=False)
Change_w.encoding = "utf-8"
status = 27047
a_dict = ({"numb_order": "" + str(numb_Zap) + "","status_order": "" + str(status) + ""},)
with open('tbl.json') as f:
data_orders = json.load(f)
data_orders[0]["orders"] += list(a_dict)
with open('tbl.json', 'w') as f:
json.dump(data_orders, f)
print(str(numb_Zap) + 'Внесен в список со значением ' + str(status)')
in_work()