From 5076ae5ade1171b488ad2ec429048215d8fbb215 Mon Sep 17 00:00:00 2001 From: Bobbe Date: Sun, 30 Jun 2024 01:53:39 +0200 Subject: [PATCH] Fix searching for parts by digikey part number (#14) --- inventree_part_import/suppliers/supplier_digikey.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/inventree_part_import/suppliers/supplier_digikey.py b/inventree_part_import/suppliers/supplier_digikey.py index 40bf769..b5ed021 100644 --- a/inventree_part_import/suppliers/supplier_digikey.py +++ b/inventree_part_import/suppliers/supplier_digikey.py @@ -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(