diff --git a/pyproject.toml b/pyproject.toml index 2609f02..677278d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "saic_ismart_client_ng" -version = "0.8.0" +version = "0.8.1" description = "SAIC next gen client library (MG iSMART)" authors = [ { name = "Giovanni Condello", email = "saic-python-client@nanomad.net" }, diff --git a/src/saic_ismart_client_ng/model.py b/src/saic_ismart_client_ng/model.py index b3072ce..a0974a1 100644 --- a/src/saic_ismart_client_ng/model.py +++ b/src/saic_ismart_client_ng/model.py @@ -13,6 +13,7 @@ def __init__( tenant_id: str = "459771", region: str = "eu", sms_delivery_delay: float = 3.0, + read_timeout: float = 5.0, ) -> None: self.__username = username self.__password = password @@ -22,6 +23,7 @@ def __init__( self.__tenant_id = tenant_id self.__region = region self.__sms_delivery_delay = sms_delivery_delay + self.__read_timeout = read_timeout @property def username(self) -> str: @@ -54,3 +56,7 @@ def region(self) -> str: @property def sms_delivery_delay(self) -> float: return self.__sms_delivery_delay + + @property + def read_timeout(self) -> float: + return self.__read_timeout diff --git a/src/saic_ismart_client_ng/net/client/__init__.py b/src/saic_ismart_client_ng/net/client/__init__.py index c0182e3..6e024b0 100644 --- a/src/saic_ismart_client_ng/net/client/__init__.py +++ b/src/saic_ismart_client_ng/net/client/__init__.py @@ -5,7 +5,7 @@ from typing import TYPE_CHECKING import httpx -from httpx import Request, Response +from httpx import Request, Response, Timeout from saic_ismart_client_ng.net.httpx import ( decrypt_httpx_response, @@ -29,10 +29,11 @@ def __init__( self.__user_token: str = "" self.__class_name: str = "" self.__client = httpx.AsyncClient( + timeout=Timeout(timeout=configuration.read_timeout), event_hooks={ "request": [self.__invoke_request_listener, self.__encrypt_request], "response": [decrypt_httpx_response, self.__invoke_response_listener], - } + }, ) async def send(self, request: Request) -> Response: