aboutsummaryrefslogtreecommitdiff
path: root/src/ee/tools
diff options
context:
space:
mode:
authorTrygve Laugstøl <trygvis@inamo.no>2019-05-28 09:46:41 +0200
committerTrygve Laugstøl <trygvis@inamo.no>2019-05-28 09:46:41 +0200
commit2e2956823c9cd02c766b296cbcbea9130bd07b36 (patch)
tree29be58764f33374cd768a5151182d1a2aa75b041 /src/ee/tools
parentd108963a31f726ec8e1f471695addbbabb0db312 (diff)
downloadee-python-2e2956823c9cd02c766b296cbcbea9130bd07b36.tar.gz
ee-python-2e2956823c9cd02c766b296cbcbea9130bd07b36.tar.bz2
ee-python-2e2956823c9cd02c766b296cbcbea9130bd07b36.tar.xz
ee-python-2e2956823c9cd02c766b296cbcbea9130bd07b36.zip
digikey: Better search when getting multiple results back. Instead of
doing a new search with the selected digikey part number, do a direct lookup with the product's URL instead. This ensures that we always get a match and don't get confused when multiple part numbers are returned.
Diffstat (limited to 'src/ee/tools')
-rw-r--r--src/ee/tools/digikey_download_facts.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/ee/tools/digikey_download_facts.py b/src/ee/tools/digikey_download_facts.py
index 5cfdba7..d7ecce5 100644
--- a/src/ee/tools/digikey_download_facts.py
+++ b/src/ee/tools/digikey_download_facts.py
@@ -1,3 +1,6 @@
+if True:
+ raise Exception("This module is deprecated.")
+
import argparse
from functools import total_ordering
@@ -5,9 +8,6 @@ import ee.digikey as dk
from ee.digikey import SearchResponseTypes, DigikeyProduct
from ee.tools import log
-if True:
- raise Exception("This module is deprecated.")
-
@total_ordering
class Query(object):
@@ -83,7 +83,7 @@ for q in queries:
continue
log.info("Searching for {}".format(p))
- response = parser.parse_string(client.search(p))
+ response = parser.parse_string(client.baseurl, client.search(p))
todos = []
@@ -113,7 +113,7 @@ for q in queries:
log.warn("Part not found")
for part_number in todos:
- response = parser.parse_string(client.search(part_number))
+ response = parser.parse_string(client.baseurl, client.search(part_number))
if response.response_type == SearchResponseTypes.SINGLE:
p = sorted(response.products, key=lambda p: p.part_number)[0]