Skip to content

Commit

Permalink
Fix searching for parts by digikey part number (#14)
Browse files Browse the repository at this point in the history
  • Loading branch information
30350n committed Jun 30, 2024
1 parent d2e053f commit 5076ae5
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions inventree_part_import/suppliers/supplier_digikey.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,17 @@ def setup(self, client_id, client_secret, currency, language, location):
return True

def search(self, search_term):
for retry in retry_timeouts():
with retry:
digikey_part = digikey.product_details(
search_term,
x_digikey_locale_currency=self.currency,
x_digikey_locale_site=self.location,
x_digikey_locale_language=self.language,
)
if digikey_part and search_term == digikey_part.digi_key_part_number:
return [self.get_api_part(digikey_part)], 1

for retry in retry_timeouts():
with retry:
results = digikey.keyword_search(
Expand Down

0 comments on commit 5076ae5

Please sign in to comment.