refactor: unify api.send_*_request() functions#435
Merged
raphael0202 merged 1 commit intoopenfoodfacts:developfrom Mar 3, 2026
Merged
refactor: unify api.send_*_request() functions#435raphael0202 merged 1 commit intoopenfoodfacts:developfrom
raphael0202 merged 1 commit intoopenfoodfacts:developfrom
Conversation
Contributor
Author
|
I’ve added a couple of tests, but not sure what other tests to add for now, esp. given most of the “pathways” are getting testing via the |
Freso
added a commit
to Freso/openfoodfacts-python
that referenced
this pull request
Feb 17, 2026
Freso
added a commit
to Freso/openfoodfacts-python
that referenced
this pull request
Feb 21, 2026
raphael0202
reviewed
Feb 27, 2026
raphael0202
reviewed
Feb 27, 2026
raphael0202
reviewed
Feb 27, 2026
raphael0202
requested changes
Feb 27, 2026
Contributor
raphael0202
left a comment
There was a problem hiding this comment.
Thank you, that's better this way indeed! :)
I added a couple of comments
d00bc07 to
941b8c6
Compare
\## Description - Right now we have 3 different `send_*_request()` functions that all implement a lot of the same logic and mostly only differ in the HTTP method used. - This means that if we want to add additional HTTP method calls (e.g., Folksonomy’s API has `DELETE` and `PUT` endpoints), it would require more `send_*_request()` functions which again would need to implement some of the same logic again and just add more functions needed to maintain for downstream end-users. \## Solution - This creates a new function, `send_request()`, which combines the functionality of the three existing `send_*_request()` functions - It also makes the three `api.send_*_request()` functions wrappers around this new function
|
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.



Description
send_*_request()functions that all implement a lot of the same logic and mostly only differ in the HTTP method used.DELETEandPUTendpoints), it would require moresend_*_request()functions which again would need to implement some of the same logic again and just add more functions needed to maintain for downstream end-users.Solution
_send_request(), which combines the functionality of the three existingsend_*_request()functionsapi.send_*_request()functions wrappers around this new function and deprecates them so they can be removed in 4.0.0.