Skip to content

Commit

Permalink
fix: add timeout parameter to API
Browse files Browse the repository at this point in the history
  • Loading branch information
raphael0202 committed Dec 1, 2023
1 parent 64ee295 commit b08b9d0
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions openfoodfacts/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,7 @@ def __init__(
version: Union[APIVersion, str] = APIVersion.v2,
environment: Union[Environment, str] = Environment.org,
session_cookie: Optional[str] = None,
timeout: int = 10,
) -> None:
"""Initialize the API instance.
Expand All @@ -271,6 +272,7 @@ def __init__(
to Environment.org
:param session_cookie: a session cookie, only used for write requests,
defaults to None
:param timeout: the timeout for HTTP requests, defaults to 10 seconds
"""
if not isinstance(country, Country):
country = Country[country]
Expand All @@ -284,6 +286,7 @@ def __init__(
username=username,
password=password,
session_cookie=session_cookie,
timeout=timeout,
)
self.password = password
self.country = country
Expand Down

0 comments on commit b08b9d0

Please sign in to comment.