Skip to content

Configurable httpx timeouts #16

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

Merged
merged 1 commit into from
May 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -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" },
Expand Down
6 changes: 6 additions & 0 deletions src/saic_ismart_client_ng/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand Down Expand Up @@ -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
5 changes: 3 additions & 2 deletions src/saic_ismart_client_ng/net/client/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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:
Expand Down