4
4
# ------------------------------------
5
5
from __future__ import annotations
6
6
7
- from typing import Dict , List , Optional
7
+ from typing import Optional
8
8
9
9
import httpx
10
10
from kiota_abstractions .request_option import RequestOption
@@ -27,7 +27,7 @@ def create_with_default_middleware( # type: ignore
27
27
api_version : APIVersion = APIVersion .v1 ,
28
28
client : Optional [httpx .AsyncClient ] = None ,
29
29
host : NationalClouds = NationalClouds .Global ,
30
- options : Optional [Dict [str , RequestOption ]] = None
30
+ options : Optional [dict [str , RequestOption ]] = None
31
31
) -> httpx .AsyncClient :
32
32
"""Constructs native HTTP AsyncClient(httpx.AsyncClient) instances configured with
33
33
a custom transport loaded with a default pipeline of middleware.
@@ -39,8 +39,8 @@ def create_with_default_middleware( # type: ignore
39
39
Defaults to KiotaClientFactory.get_default_client().
40
40
host (NationalClouds): The national clound endpoint to be used.
41
41
Defaults to NationalClouds.Global.
42
- options (Optional[Dict [str, RequestOption]]): The request options to use when
43
- instantiating default middleware. Defaults to Dict [str, RequestOption]=None.
42
+ options (Optional[dict [str, RequestOption]]): The request options to use when
43
+ instantiating default middleware. Defaults to dict [str, RequestOption]=None.
44
44
45
45
Returns:
46
46
httpx.AsyncClient: An instance of the AsyncClient object
@@ -56,15 +56,15 @@ def create_with_default_middleware( # type: ignore
56
56
@staticmethod
57
57
def create_with_custom_middleware ( # type: ignore
58
58
# Breaking change to remove Kiota client factory as base class
59
- middleware : Optional [List [BaseMiddleware ]],
59
+ middleware : Optional [list [BaseMiddleware ]],
60
60
api_version : APIVersion = APIVersion .v1 ,
61
61
client : Optional [httpx .AsyncClient ] = None ,
62
62
host : NationalClouds = NationalClouds .Global ,
63
63
) -> httpx .AsyncClient :
64
64
"""Applies a custom middleware chain to the HTTP Client
65
65
66
66
Args:
67
- middleware(List [BaseMiddleware]): Custom middleware list that will be used to create
67
+ middleware(list [BaseMiddleware]): Custom middleware list that will be used to create
68
68
a middleware pipeline. The middleware should be arranged in the order in which they will
69
69
modify the request.
70
70
api_version (APIVersion): The Graph API version to be used.
@@ -87,7 +87,7 @@ def _get_base_url(host: str, api_version: APIVersion) -> str:
87
87
88
88
@staticmethod
89
89
def _get_telemetry_handler (
90
- options : Optional [Dict [str , RequestOption ]]
90
+ options : Optional [dict [str , RequestOption ]]
91
91
) -> GraphTelemetryHandler :
92
92
"""Helper method to get the graph telemetry handler instantiated with appropriate
93
93
options"""
@@ -102,7 +102,7 @@ def _get_telemetry_handler(
102
102
103
103
@staticmethod
104
104
def _load_middleware_to_client (
105
- client : httpx .AsyncClient , middleware : Optional [List [BaseMiddleware ]]
105
+ client : httpx .AsyncClient , middleware : Optional [list [BaseMiddleware ]]
106
106
) -> httpx .AsyncClient :
107
107
current_transport = client ._transport
108
108
client ._transport = GraphClientFactory ._replace_transport_with_custom_graph_transport (
@@ -123,7 +123,7 @@ def _load_middleware_to_client(
123
123
124
124
@staticmethod
125
125
def _replace_transport_with_custom_graph_transport (
126
- current_transport : httpx .AsyncBaseTransport , middleware : Optional [List [BaseMiddleware ]]
126
+ current_transport : httpx .AsyncBaseTransport , middleware : Optional [list [BaseMiddleware ]]
127
127
) -> AsyncGraphTransport :
128
128
middleware_pipeline = KiotaClientFactory .create_middleware_pipeline (
129
129
middleware , current_transport
0 commit comments