Closed sebo83910 closed 2 years ago
@sebo83910 What is the error? Please copy full traceback.
Hi @eeintech Here is the trace:
'ManufacturerProductDetailsRequest' object has no attribute 'keywords'Request Method: | POST -- | -- http://192.168.2.4:8000/gestion_obso/ 3.1.7 AttributeError 'ManufacturerProductDetailsRequest' object has no attribute 'keywords' /usr/local/lib/python3.9/site-packages/digikey/v3/api.py, line 110, in manufacturer_product_details /usr/local/bin/python 3.9.1 ['/app', '/usr/local/lib/python39.zip', '/usr/local/lib/python3.9', '/usr/local/lib/python3.9/lib-dynload', '/usr/local/lib/python3.9/site-packages'] Thu, 22 Jul 2021 14:43:02 +0000
aceback Switch to copy-and-paste view
/usr/local/lib/python3.9/site-packages/django/core/handlers/exception.py, line 47, in inner
response = get_response(request)
…
▶ Local vars
/usr/local/lib/python3.9/site-packages/django/core/handlers/base.py, line 181, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
…
▶ Local vars
/app/oxybom/gestion_obso.py, line 266, in gestion_obso
exceldigikey.create_obso_xls(client=fdigikey, dico=dico_digikey, pmi_list=pmi_list_digikey, fichier_xslx=outputfile)
…
▶ Local vars
/app/oxybom/weboxydigikey/digikeyexcelclient.py, line 217, in create_obso_xls
result = client.get_product_obsolescence(component)
…
▶ Local vars
/app/oxybom/weboxydigikey/digikeyclient.py, line 130, in get_product_obsolescence
result = self.interro_manufacturer_product_details(manf=manf)
…
▶ Local vars
/app/oxybom/weboxydigikey/digikeyclient.py, line 60, in interro_manufacturer_product_details
result = digikey.manufacturer_product_details(body=search_request)
…
▶ Local vars
/usr/local/lib/python3.9/site-packages/digikey/v3/api.py, line 110, in manufacturer_product_details
logger.info(f'Search for: {kwargs["body"].keywords}')
…
▶ Local vars
What is the MPN that makes this fail to be able to reproduce?
Here is the manf: CRCW12061K00FKEAHP. this reference is found on the digikey web site. The API works well on my PC virtualenv. It just fails in the docker container...
date | stream | content -- | -- | -- 2021-07-23 11:32:40 | stderr | [23/Jul/2021 11:32:40] "POST /gestion_obso/ HTTP/1.1" 500 91892 2021-07-23 11:32:40 | stderr | AttributeError: 'ManufacturerProductDetailsRequest' object has no attribute 'keywords' 2021-07-23 11:32:40 | stderr | logger.info(f'Search for: {kwargs["body"].keywords}') 2021-07-23 11:32:40 | stderr | File "/usr/local/lib/python3.9/site-packages/digikey/v3/api.py", line 110, in manufacturer_product_details 2021-07-23 11:32:40 | stderr | result = digikey.manufacturer_product_details(body=search_request) 2021-07-23 11:32:40 | stderr | File "/app/weboxydigikey/digikeyclient.py", line 60, in interro_manufacturer_product_details 2021-07-23 11:32:40 | stderr | result = self.interro_manufacturer_product_details(manf=manf) 2021-07-23 11:32:40 | stderr | File "/app/weboxydigikey/digikeyclient.py", line 131, in get_product_obsolescence 2021-07-23 11:32:40 | stderr | result = client.get_product_obsolescence(component) 2021-07-23 11:32:40 | stderr | File "/app/weboxydigikey/digikeyexcelclient.py", line 217, in create_obso_xls 2021-07-23 11:32:40 | stderr | exceldigikey.create_obso_xls(client=fdigikey, dico=dico_digikey, pmi_list=pmi_list_digikey, fichier_xslx=outputfile) 2021-07-23 11:32:40 | stderr | File "/app/gestion_obso.py", line 266, in gestion_obso 2021-07-23 11:32:40 | stderr | response = wrapped_callback(request, *callback_args, **callback_kwargs) 2021-07-23 11:32:40 | stderr | File "/usr/local/lib/python3.9/site-packages/django/core/handlers/base.py", line 181, in _get_response 2021-07-23 11:32:40 | stderr | response = get_response(request) 2021-07-23 11:32:40 | stderr | File "/usr/local/lib/python3.9/site-packages/django/core/handlers/exception.py", line 47, in inner 2021-07-23 11:32:40 | stderr | Traceback (most recent call last): 2021-07-23 11:32:40 | stderr | ERROR:django.request:Internal Server Error: /gestion_obso/ 2021-07-23 11:32:40 | stderr | AttributeError: 'ManufacturerProductDetailsRequest' object has no attribute 'keywords' 2021-07-23 11:32:40 | stderr | logger.info(f'Search for: {kwargs["body"].keywords}') 2021-07-23 11:32:40 | stderr | File "/usr/local/lib/python3.9/site-packages/digikey/v3/api.py", line 110, in manufacturer_product_details 2021-07-23 11:32:40 | stderr | result = digikey.manufacturer_product_details(body=search_request) 2021-07-23 11:32:40 | stderr | File "/app/weboxydigikey/digikeyclient.py", line 60, in interro_manufacturer_product_details 2021-07-23 11:32:40 | stderr | result = self.interro_manufacturer_product_details(manf=manf) 2021-07-23 11:32:40 | stderr | File "/app/weboxydigikey/digikeyclient.py", line 131, in get_product_obsolescence 2021-07-23 11:32:40 | stderr | result = client.get_product_obsolescence(component) 2021-07-23 11:32:40 | stderr | File "/app/weboxydigikey/digikeyexcelclient.py", line 217, in create_obso_xls 2021-07-23 11:32:40 | stderr | exceldigikey.create_obso_xls(client=fdigikey, dico=dico_digikey, pmi_list=pmi_list_digikey, fichier_xslx=outputfile) 2021-07-23 11:32:40 | stderr | File "/app/gestion_obso.py", line 266, in gestion_obso 2021-07-23 11:32:40 | stderr | response = wrapped_callback(request, *callback_args, **callback_kwargs) 2021-07-23 11:32:40 | stderr | File "/usr/local/lib/python3.9/site-packages/django/core/handlers/base.py", line 181, in _get_response 2021-07-23 11:32:40 | stderr | response = get_response(request) 2021-07-23 11:32:40 | stderr | File "/usr/local/lib/python3.9/site-packages/django/core/handlers/exception.py", line 47, in inner 2021-07-23 11:32:40 | stderr | Traceback (most recent call last): 2021-07-23 11:32:40 | stderr | Internal Server Error: /gestion_obso/ 2021-07-23 11:32:40 | stderr | DEBUG:digikey.oauth.oauth2:Using API V3 2021-07-23 11:32:40 | stderr | 2021-07-23 11:32:40,708 - digikey.oauth.oauth2 - DEBUG: Using API V3 2021-07-23 11:32:40 | stderr | INFO:weboxydigikey.digikeyclient:interro_manufacturer_product_details: CRCW12061K00FKEAHP 2021-07-23 11:32:40 | stderr | 2021-07-23 11:32:40,707 - weboxydigikey - INFO: interro_manufacturer_product_details: CRCW12061K00FKEAHP 2021-07-23 11:32:40 | stdout | digikey manf: CRCW12061K00FKEAHP@sebo83910 I was able to reproduce in virtual env with Python 3.8.10 and I think is the same error as in issue #8 unfortunately...
The response seems to be missing the keywords
property so a check should be added on it here: https://github.com/peeter123/digikey-api/blob/9f4017bf73a4dcb27d39204ea2be5029cce5f77d/digikey/v3/api.py#L103
Have you tried running the search with product_details
instead?
import digikey
result = digikey.product_details('CRCW12061K00FKEAHP').to_dict()
print(result)
For you second question, I think it's telling you that it does not know the api_limit
argument value, you'll have to retrieve it before using the keyword_search
. Which I think was the topic of #10 but don't know that it was pushed to PyPI release unfortunately...
Hello,
I'm using your API within a docker instance. I do have the following error during execution:
the API is ok with Python 3.8.10 while in docker Python 3.9.1 is run. Moreover, I had a previous error with this call
api_limits was unknown... Pip show digikay-api return version 0.4.0.