TME info provider: migrate to APi verion 2#1447
Open
carmisergio wants to merge 7 commits into
Open
Conversation
Author
|
Translation file was messed up, sorry about that. Should all be fixed now. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
As per the API documentation, the v1 (Legacy) API will only be maintained until June 30, 2027. In addition, API tokens generated after May 14, 2026 can only be used with API v2, rendering it impossible for new users of Part-DB to access the TME info provider.
Solution
Update the relevant
TMEProviderimplementation to make use of the new API. The structure of the new version is not very different from the legacy one, so no huge changes are necessary.The only significant change is in how authentication is handled: the new API requires a specific call to the
/auth/tokenendpoint, which returns a session token to be used for subsequent queries. Theinfo_provider.cacheis used to store the session token. TheTMEClienttransparently handles requesting and renewing the session token.Footprints
I have noticed that when both
Case - mmandCase -inch(respectively IDs 2931 and 2932) are present in the parameter list, noCase(ID 35) is provided. In this situation, by default the provider uses the inch version to populate the footprint field, and I have added a new setting option to prefer the metric version instead.Testing
Added new tests for
TMEClientto verify the new authentication logic.Modified
TMEProvidertests to reflect new API version.All tests pass locally.