Skip to content

Commit

Permalink
fix: minor fix in ProductResource.get
Browse files Browse the repository at this point in the history
to get a better representation of the URL
  • Loading branch information
raphael0202 committed Dec 1, 2023
1 parent 163b33b commit 54a8809
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions openfoodfacts/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ def __init__(self, api_config: APIConfig):
country_code=self.api_config.country.name,
)

def get(self, code: str, fields: Optional[List[str]] = None) -> Optional[dict]:
def get(self, code: str, fields: Optional[List[str]] = None) -> Optional[JSONType]:
"""Return a product.
:param code: barcode of the product
Expand All @@ -114,7 +114,7 @@ def get(self, code: str, fields: Optional[List[str]] = None) -> Optional[dict]:
:return: the API response
"""
fields = fields or []
url = f"{self.base_url}/api/{self.api_config.version}/product/{code}"
url = f"{self.base_url}/api/{self.api_config.version.value}/product/{code}"

if fields:
# requests escape comma in URLs, as expected, but openfoodfacts
Expand Down

0 comments on commit 54a8809

Please sign in to comment.