peeter123 / digikey-api

Python module for the Digikey PartSearch API
GNU General Public License v3.0
85 stars 35 forks source link

Unable to search for a part #22

Closed dossalab closed 3 years ago

dossalab commented 3 years ago

Hi!

I'm running a very simple demo based on example in Readme:

import digikey
import sys
import logging
from digikey.v3.productinformation import KeywordSearchRequest

digikey.logger.setLevel(logging.CRITICAL)
query=sys.argv[1]

print(f'searching for \'{query}\'')

search_request = KeywordSearchRequest(keywords=query, record_count=10)
result = digikey.keyword_search(body=search_request)

for res in result.products:
    print(res.product_description)

However, the only thing it prints no matter what I type is:

CAP ALUM 1000UF 20% 35V RADIAL

Enabling debug shows that it tries for the correct query:

2021-08-07 15:47:00,941 - digikey.oauth.oauth2 -    DEBUG: Using API V3
2021-08-07 15:47:00,942 -       digikey.v3.api -     INFO: Search for: 100k 0603
2021-08-07 15:47:00,942 -       digikey.v3.api -    DEBUG: CALL -> keyword_search
2021-08-07 15:47:00,942 -       digikey.v3.api -    DEBUG: CALL wrapped -> PartSearchApi.keyword_search_with_http_info
2021-08-07 15:47:01,672 -       digikey.v3.api -    DEBUG: Requests remaining: [966/1000]

Thanks in advance!

dossalab commented 3 years ago

Oh, that's probably because I'm using a sandbox app, they don't have full search functionality there. Switching to production fixed the issue!