Fix bug with part name in query_search
This commit is contained in:
parent
44efc4006e
commit
cbe7225fc9
@ -70,6 +70,8 @@ def query_search(partnum, source):
|
||||
if idx < 0:
|
||||
fprint("Could not find part in API: " + partnum)
|
||||
return False
|
||||
|
||||
name = a["results"][idx]["title"]
|
||||
#fprint("Search result found: result " + str(idx) + ", for ID " + name)
|
||||
#urlname = a["results"][0]["raw"]["catalogitemurlname"]
|
||||
img = a["results"][idx]["raw"]["catalogitemimageurl"]
|
||||
@ -90,7 +92,7 @@ def query_search(partnum, source):
|
||||
out["description"] = desc
|
||||
out["image"] = "https://www.belden.com" + img
|
||||
out["partnum"] = name
|
||||
#print(out)
|
||||
print(out)
|
||||
return out
|
||||
except:
|
||||
print("Failed to search with API. Falling back to datasheet lookup.")
|
||||
@ -453,8 +455,8 @@ if __name__ == "__main__":
|
||||
"BLC6D1100007"
|
||||
|
||||
]
|
||||
print(query_search("74002", "Belden"))
|
||||
#get_multi(partnums, 0.25)
|
||||
#print(query_search("TT-SLG-024-HTNN", "Belden"))
|
||||
get_multi(partnums, 0.25)
|
||||
#query_search("10GXS13", "Belden")
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user