diff --git a/run.py b/run.py index 7808754..1dfcd3f 100755 --- a/run.py +++ b/run.py @@ -173,7 +173,27 @@ def check_server(): 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"]: - tmp1["description"] = fs["Product Overview"]["Suitable Applications"] + if len(fs["Product Overview"]["Suitable Applications"]) == 0 or not isinstance(fs["Product Overview"]["Suitable Applications"], str): + print(cable_list[idx], fs["Product Overview"]["Suitable Applications"]) + for key, value in fs["Product Overview"].items(): + #print(key,value) + if len(value) > 5 and isinstance(value, str): + tmp1["description"] = value + elif len(key) > 15 and not isinstance(value, str): + tmp1["description"] = key + else: + tmp1["description"] = fs["Product Overview"]["Suitable Applications"] + elif "Product Overview" in fs and "Suitable Applications:" in fs["Product Overview"]: + if len(fs["Product Overview"]["Suitable Applications:"]) == 0 or not isinstance(fs["Product Overview"]["Suitable Applications:"], str): + print(cable_list[idx], fs["Product Overview"]["Suitable Applications:"]) + for key, value in fs["Product Overview"].items(): + #print(key,value) + if len(value) > 5 and isinstance(value, str): + tmp1["description"] = value + elif len(key) > 15 and not isinstance(value, str): + tmp1["description"] = key + else: + tmp1["description"] = fs["Product Overview"]["Suitable Applications:"] tmp.append(tmp1) out = {"map": tmp}