You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
importosfrompathlibimportPathimportdigikeyfromdigikey.v3.productinformationimportKeywordSearchRequestfromdigikey.v3.batchproductdetailsimportBatchProductDetailsRequestCACHE_DIR=os.path.join(os.getcwd(), 'dir')
os.environ['DIGIKEY_CLIENT_ID'] ='DIGIKEY_CLIENT_ID'os.environ['DIGIKEY_CLIENT_SECRET'] ='DIGIKEY_CLIENT_SECRET'os.environ['DIGIKEY_CLIENT_SANDBOX'] ='True'os.environ['DIGIKEY_STORAGE_PATH'] =CACHE_DIRprint(os.environ['DIGIKEY_STORAGE_PATH'])
# Query product numberdkpn='296-6501-1-ND'part=digikey.product_details(dkpn)
# Search for partssearch_request=KeywordSearchRequest(keywords='CRCW080510K0FKEA', record_count=10)
result=digikey.keyword_search(body=search_request)
# Only if BatchProductDetails endpoint is explicitly enabled# Search for Batch of Parts/Productmpn_list= ["0ZCK0050FF2E", "LR1F1K0"] #Length upto 50batch_request=BatchProductDetailsRequest(products=mpn_list)
part_results=digikey.batch_product_details(body=batch_request)
the output is:
<WORKSPACE>\dir
Traceback (most recent call last):
File "<WORKSPACE>\d_api.py", line 18, in <module>
part = digikey.product_details(dkpn)
File "<USER>\AppData\Local\Programs\Python\Python310\lib\site-packages\digikey\v3\api.py", line 121, in product_details
client = DigikeyApiWrapper('product_details_with_http_info', digikey.v3.productinformation)
File "<USER>\AppData\Local\Programs\Python\Python310\lib\site-packages\digikey\v3\api.py", line 55, in __init__
self._digikeyApiToken = digikey.oauth.oauth2.TokenHandler(version=3, sandbox=self.sandbox).get_access_token()
File "<USER>\AppData\Local\Programs\Python\Python310\lib\site-packages\digikey\oauth\oauth2.py", line 132, in __init__
raise ValueError(
ValueError: STORAGE PATH must be set and must exist.Set "DIGIKEY_STORAGE_PATH" as an environment variable, or pass your keys directly to the client.
I tried putting in the actual path, setting an windows environment variable manually in settings and via set, setx, tried https://stackoverflow.com/a/59489965 but output was all the same.
The text was updated successfully, but these errors were encountered:
by running your default script:
I tried putting in the actual path, setting an windows environment variable manually in settings and via
set
,setx
, tried https://stackoverflow.com/a/59489965 but output was all the same.The text was updated successfully, but these errors were encountered: