1111
1212
1313class HTTPClientFactory :
14- """
15- Constructs HTTP Client(session) instances configured with either custom or default
14+ """Constructs native HTTP Client(session) instances configured with either custom or default
1615 pipeline of middleware.
16+
17+ :func: Class constructor accepts a user provided session object and kwargs to configure the
18+ request handling behaviour of the client
19+ :keyword enum api_version: The Microsoft Graph API version to be used, for example
20+ `APIVersion.v1` (default). This value is used in setting the base url for all requests for
21+ that session.
22+ :class:`~msgraphcore.enums.APIVersion` defines valid API versions.
23+ :keyword enum cloud: a supported Microsoft Graph cloud endpoint.
24+ Defaults to `NationalClouds.Global`
25+ :class:`~msgraphcore.enums.NationalClouds` defines supported sovereign clouds.
26+ :keyword tuple timeout: Default connection and read timeout values for all session requests.
27+ Specify a tuple in the form of Tuple(connect_timeout, read_timeout) if you would like to set
28+ the values separately. If you specify a single value for the timeout, the timeout value will
29+ be applied to both the connect and the read timeouts.
30+ :keyword obj session: A custom Session instance from the python requests library
1731 """
1832 def __init__ (self , ** kwargs ):
1933 """Class constructor that accepts a user provided session object and kwargs
@@ -27,15 +41,24 @@ def __init__(self, **kwargs):
2741 self ._set_default_timeout ()
2842
2943 def create_with_default_middleware (self , credential : TokenCredential , ** kwargs ) -> Session :
30- """Applies the default middleware chain to the HTTP Client"""
44+ """Applies the default middleware chain to the HTTP Client
45+
46+ :param credential: TokenCredential used to acquire an access token for the Microsoft
47+ Graph API. Created through one of the credential classes from `azure.identity`
48+ """
3149 middleware = [
3250 AuthorizationHandler (credential , ** kwargs ),
3351 ]
3452 self ._register (middleware )
3553 return self .session
3654
3755 def create_with_custom_middleware (self , middleware : [BaseMiddleware ]) -> Session :
38- """Applies a custom middleware chain to the HTTP Client """
56+ """Applies a custom middleware chain to the HTTP Client
57+
58+ :param list middleware: Custom middleware(HTTPAdapter) list that will be used to create
59+ a middleware pipeline. The middleware should be arranged in the order in which they will
60+ modify the request.
61+ """
3962 if not middleware :
4063 raise ValueError ("Please provide a list of custom middleware" )
4164 self ._register (middleware )
0 commit comments