Pull description from Belden API for more consistent values

This commit is contained in:
2024-05-08 16:44:22 -05:00
parent a905858e3b
commit 21cb2beb67
5 changed files with 64 additions and 21 deletions

12
run.py
View File

@@ -168,8 +168,6 @@ def check_server():
cabledata = jbs.get_position(str(idx))
fs = cabledata["fullspecs"]
tmp1 = {"part_number": cable_list[idx], "position": idx, "name": cable_list[idx], "brand": cabledata["brand"] }
if "image" in cabledata:
tmp1["image"] = cabledata["image"]
if "Product Overview" in fs and "Product Category" in fs["Product Overview"]:
tmp1["short_description"] = fs["Product Overview"]["Product Category"]
if "Product Overview" in fs and "Suitable Applications" in fs["Product Overview"]:
@@ -194,7 +192,15 @@ def check_server():
tmp1["description"] = key
else:
tmp1["description"] = fs["Product Overview"]["Suitable Applications:"]
if "image" in cabledata:
tmp1["image"] = cabledata["image"]
if "description" in cabledata:
tmp1["description"] = cabledata["description"]
if "short_description" in cabledata:
tmp1["short_description"] = cabledata["short_description"]
if "application" in cabledata:
tmp1["application"] = cabledata["application"]
tmp.append(tmp1)
out = {"map": tmp}
fprint(out)