feat: search-a-licious integration to the Python SDK#326
feat: search-a-licious integration to the Python SDK#326hahacen wants to merge 2 commits intoopenfoodfacts:developfrom
Conversation
|
raphael0202
left a comment
There was a problem hiding this comment.
First, sorry for the delay in the code review, the permanent team has been quite overwhelmed lately.
Thank you for your contribution! I think you implemented the wrong search endpoint, you can find more details on my comment below.
| self.facet = FacetResource(self.api_config) | ||
| self.robotoff = RobotoffResource(self.api_config) | ||
|
|
||
| def search_advanced(self, query: str, filters: dict = None, page: int = 1): |
There was a problem hiding this comment.
Invalid type for filters parameter here:
| def search_advanced(self, query: str, filters: dict = None, page: int = 1): | |
| def search_advanced(self, query: str, filters: Optional[dict] = None, page: int = 1): |
| def search_advanced(self, query: str, filters: dict = None, page: int = 1): | ||
| """Advanced product search using Search-a-licious endpoint.""" | ||
| filters = filters or {} | ||
| params = {"search_terms": query, "page": page, **filters} |
There was a problem hiding this comment.
The search terms should be provided using the q parameter, see the search-a-licious documentation here: https://search.openfoodfacts.org/docs#/default/search_get_search_get
| """Advanced product search using Search-a-licious endpoint.""" | ||
| filters = filters or {} | ||
| params = {"search_terms": query, "page": page, **filters} | ||
| url = f"{self.product.base_url}/cgi/search.pl" |
There was a problem hiding this comment.
This is not search-a-licious endpoint, https://search.openfoodfacts.org/search is the right one
|
can someone please merge it? |
|
And the requested changes above were not done yet! |



Add support for Advanced Search (search_advanced)
This pull request adds the search_advanced(query, filters=None, page=1) method to the Open Food Facts Python SDK, addressing Issue #314.
• Allows developers to perform advanced product searches with optional filters and pagination.
• Integrated cleanly into the existing API class.
• Includes error handling for missing responses.
Fixes Integrate search-a-licious endpoint into the Python SDK #314.