mhubig / docker-partkeepr

mhubig/partkeepr docker image repository
63 stars 64 forks source link

octopart search not working #40

Open flashfingaz opened 3 years ago

flashfingaz commented 3 years ago

fresh install, added octopart api key and got error 500 when trying to fetch data (everything else works fine):

[2021-01-22 20:56:35] request.CRITICAL: Uncaught PHP Exception Guzzle\Http\Exception\ClientErrorResponseException: "Client error response [status code] 401 [reason phrase] Unauthorized [url] http://octopart.com/api/v3/parts/search?apikey=[MY-API-KEY-LIVES-HERE]&q=esp32&start=0&include%5B0%5D=short_description&include%5B1%5D=specs&include%5B2%5D=datasheets&limit=20" at /var/www/html/vendor/guzzle/guzzle/src/Guzzle/Http/Exception/BadResponseException.php line 43 {"exception":"[object] (Guzzle\Http\Exception\ClientErrorResponseException(code: 0): Client error response\n[status code] 401\n[reason phrase] Unauthorized\n[url] http://octopart.com/api/v3/parts/search?apikey=XXXXXXXXXXXXXX&q=esp32&start=0&include%5B0%5D=short_description&include%5B1%5D=specs&include%5B2%5D=datasheets&limit=20 at /var/www/html/vendor/guzzle/guzzle/src/Guzzle/Http/Exception/BadResponseException.php:43)"} []

turns out that:

  1. partkeepr release used by your docker image uses api v3
  2. octopart is not issuing v3 api keys anymore
  3. v4 api integration has been merged into master already: https://github.com/partkeepr/PartKeepr/pull/1150

in conclusion everyone that has not yet got an api key will not be able to use octoparts with the docker image

so my suggestion would be to build the docker image against git, or at least create a variant that would do so. would make me very happy :)

twilkie12 commented 3 years ago

For a short term fix, go into: "src/PartKeepr/OctoPartBundle/Services/OctoPartService.php" and change the "/v3/" to "/v4/rest".

This will allow you to use your v4 api key.

jumper385 commented 2 years ago

do you do this using the interactive shell on docker?