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

Add supplier jameco electronics #247

Conversation

hillsandales
Copy link
Contributor

I've added Jameco Electronics as a searchable supplier. I have a bunch of parts I bought from Jameco, and wanted to easily add them to the Inventree database. I've tested it with various part numbers and it seems to work okay. I managed to find the API URL that Jameco's search sends data to when searching on their site. I started with trying to scrape the site with bs4, but they run Cloudflare that protects against scraping. Looking at the request sent when searching a part on their site was the key and works much better. For image download, they also protect, so I used cloudscraper in that case, which gives a slight delay and also retries a few times every delay. It seems to work and downloads the image on the second attempt, if the first attempt times out.

Not sure if anyone buys parts from Jameco, but they offer project kits and parts for hobby projects, so perhaps it'll help someone else.

Let me know what you think. I tried running invoke test and it starts up, but then errors out with an error connecting to the Inventree server. I'm not sure why that is--the GUI works and creates parts on the InvenTree server fine.

@eeintech
Copy link
Contributor

eeintech commented Jul 2, 2024

errors out with an error connecting to the Inventree server. I'm not sure why that is--the GUI works and creates parts on the InvenTree server fine.

That happens with testing on main too, @T0jan and I have no idea why this is happening, if one of the run passes for me it is good enough now to release a new version but it is currently a mystery...

@eeintech
Copy link
Contributor

eeintech commented Jul 2, 2024

@hillsandales Check the CI, there is some kind of error loading the Jameco settings while launching the GUI

@hillsandales
Copy link
Contributor Author

@hillsandales Check the CI, there is some kind of error loading the Jameco settings while launching the GUI

I found a few typos. I didn't find them earlier because those sections of the code weren't being run because I had a user config directory already created in $HOME.

I ran through my additions again and fixed the typos. I removed my $HOME config directory to let the program create a new directory and copy files in. Should be okay now, I hope.

I'll submit a separate pull request for both Automation Direct and Jameco suppliers having tested both at this point.

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

Successfully merging this pull request may close these issues.

2 participants