-
-
Notifications
You must be signed in to change notification settings - Fork 104
feat: search-a-licious integration to the Python SDK #326
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -450,6 +450,21 @@ def __init__( | |
| self.facet = FacetResource(self.api_config) | ||
| self.robotoff = RobotoffResource(self.api_config) | ||
|
|
||
| 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} | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The search terms should be provided using the |
||
| url = f"{self.product.base_url}/cgi/search.pl" | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is not search-a-licious endpoint, |
||
| response = send_get_request( | ||
| url=url, | ||
| api_config=self.api_config, | ||
| params=params, | ||
| auth=get_http_auth(self.api_config.environment), | ||
| ) | ||
| if response is None: | ||
| return {} | ||
| return response | ||
|
|
||
|
|
||
| def parse_ingredients(text: str, lang: str, api_config: APIConfig) -> list[JSONType]: | ||
| """Parse ingredients text using Product Opener API. | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Invalid type for
filtersparameter here: