Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Digikey not working anymore (error 401) #578

Open
nguyen-v opened this issue Mar 19, 2025 · 7 comments
Open

Digikey not working anymore (error 401) #578

nguyen-v opened this issue Mar 19, 2025 · 7 comments

Comments

@nguyen-v
Copy link

I've been using KiCost with KiBot, but it seems like it has stopped working recently (it was working before). I've setup the API key according to:
https://github.com/set-soft/kicost-digikey-api-v3

I think it might be an issue with the (deprecated?) API V3, as digikey now uses V4. I also found this issue from another project: peeter123/digikey-api#53

 - Digi-Key [api] (https://developer.digikey.com/)
ERROR:Exception when calling manufacturer_product_details_with_http_info: (401)
Reason: Unauthorized
@set-soft
Copy link
Collaborator

I tried right now, removing my token and forcing to get a new one, and it works.

I got errors from TME (API issue) and Element14 (unable to verify its SSL certificate).

Please check that this isn't a problem with your API key.

@set-soft
Copy link
Collaborator

BTW: are you running it locally? If not: don't forget to refresh the token, it expires, digi-key isn't good for CI/CD workflows.

@gjvanderheiden
Copy link

gjvanderheiden commented Mar 21, 2025

Hi, there's been a PR for the digikey quite some time now. The digikey api doesn't get updates anymore.

I created a simple python script, which uses the digikey api project in a basic form, no banana. Doesn't work. Updated with the PR mentioned in the opening post, works. Tried a lot, deleting the cache dir etc. It is genuinely broken. Ki-nTree also uses a branch, because of the maintenance issue. See their requirements.txt.

I haven't noticed your project before, came across it because of github notification of a mention of the issue in digikey-api. First I mistakenly thought it was a reaction on the digikey-api issue. Good to see projects like this.

Edit: Really good idea to use wx-python, already installed with KiCad, instead of yet another framework. I which Ki-nTree did that.

@set-soft
Copy link
Collaborator

Hi, there's been a PR for the digikey quite some time now. The digikey api doesn't get updates anymore.

I created a simple python script, which uses the digikey api project in a basic form, no banana. Doesn't work. Updated with the PR mentioned in the opening post, works. Tried a lot, deleting the cache dir etc. It is genuinely broken. Ki-nTree also uses a branch, because of the maintenance issue. See their requirements.txt.

But this is because you are using an API key with access to the V4 API, so you won't be able to use the V3 API.

This original issue was created because @nguyen-v said "Digikey not working anymore (error 401)", and this is not the case. API V3 is working, so @nguyen-v must check other sources of problems.

I entered to the API management interface and realized that Digikey is no longer giving V3 access. As I have keys with access to V3 API I can access it, but a new user will be forced to choose "Product Information V4" API, and here comes the problem. The code only supports V3.

The PR is interesting but must be reworked because it just replaces V3 by V4, which IMHO is a very bad idea. I checked and the status of my V3 keys is "active" and with no expiration day. So old users have V3 keys and no reason to create new ones. For this reason the version must be selectable.

I haven't noticed your project before, came across it because of github notification of a mention of the issue in digikey-api. First I mistakenly thought it was a reaction on the digikey-api issue. Good to see projects like this.

Edit: Really good idea to use wx-python, already installed with KiCad, instead of yet another framework. I which Ki-nTree did that.

KiCad plug-ins should use wxPython, this helps to integrate them with KiCad, you get the same style of dialogs from a plug-in. It also helps, with installation, as you mention, you know wxPython is there, KiCad includes it. I guess Ki-nTree author wanted to use something better than wxPython ... but I agree the cost isn't a good trade-off.

I'll take a look at the code from the PR to see if I can get V4 support added.

@set-soft
Copy link
Collaborator

Ok, I released v1.1.20 with DigiKey API V4 support.
It needs a new Python package that implements it.
Also note that you MUST explicitly indicate ``version: 4` in the configuration file. People using v3 credentials doesn't need to change anything.
@gjvanderheiden : Can you try it?
@nguyen-v : Is this related to the original issue?

@nguyen-v
Copy link
Author

Ok, I released v1.1.20 with DigiKey API V4 support.
It needs a new Python package that implements it.
Also note that you MUST explicitly indicate ``version: 4` in the configuration file. People using v3 credentials doesn't need to change anything.
@gjvanderheiden : Can you try it?
@nguyen-v : Is this related to the original issue?

Sorry I haven't had the time to try your suggestions yet, I will report back soon

@gjvanderheiden
Copy link

@nguyen-v Sorry, I wasn't totally clear, I don't use this software, I was just trying to help

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants