1414from ._enums import APIVersion , NationalClouds
1515from .middleware import GraphTelemetryHandler
1616
17- DEFAULT_CONNECTION_TIMEOUT : int = 30
18- DEFAULT_REQUEST_TIMEOUT : int = 100
19-
2017
2118class GraphClientFactory (KiotaClientFactory ):
2219 """Constructs httpx.AsyncClient instances configured with either custom or default
@@ -33,16 +30,13 @@ def create_with_default_middleware(
3330 Returns:
3431 httpx.AsycClient: An instance of the AsyncClient object
3532 """
36- timeout = httpx .Timeout (DEFAULT_REQUEST_TIMEOUT , connect = DEFAULT_CONNECTION_TIMEOUT )
37- client = httpx .AsyncClient (
38- base_url = GraphClientFactory ._get_base_url (host , api_version ),
39- timeout = timeout ,
40- http2 = True
41- )
33+ client = KiotaClientFactory .get_default_client ()
34+ client .base_url = GraphClientFactory ._get_base_url (host , api_version )
4235 current_transport = client ._transport
43- middleware = KiotaClientFactory ._get_default_middleware ()
36+
37+ middleware = KiotaClientFactory .get_default_middleware ()
4438 middleware .append (GraphTelemetryHandler ())
45- middleware_pipeline = KiotaClientFactory ._create_middleware_pipeline (
39+ middleware_pipeline = KiotaClientFactory .create_middleware_pipeline (
4640 middleware , current_transport
4741 )
4842
@@ -64,14 +58,11 @@ def create_with_custom_middleware(
6458 a middleware pipeline. The middleware should be arranged in the order in which they will
6559 modify the request.
6660 """
67- timeout = httpx .Timeout (DEFAULT_REQUEST_TIMEOUT , connect = DEFAULT_CONNECTION_TIMEOUT )
68- client = httpx .AsyncClient (
69- base_url = GraphClientFactory ._get_base_url (host , api_version ),
70- timeout = timeout ,
71- http2 = True
72- )
61+ client = KiotaClientFactory .get_default_client ()
62+ client .base_url = GraphClientFactory ._get_base_url (host , api_version )
7363 current_transport = client ._transport
74- middleware_pipeline = KiotaClientFactory ._create_middleware_pipeline (
64+
65+ middleware_pipeline = KiotaClientFactory .create_middleware_pipeline (
7566 middleware , current_transport
7667 )
7768
0 commit comments