@@ -468,7 +468,8 @@ class RestClientBase(object):
468468 def __init__ (self , base_url , username = None , password = None ,
469469 default_prefix = '/redfish/v1/' , sessionkey = None ,
470470 capath = None , cafile = None , timeout = None ,
471- max_retry = None , proxies = None , check_connectivity = True ):
471+ max_retry = None , proxies = None , check_connectivity = True ,
472+ https_adapter = None ):
472473 """Initialization of the base class RestClientBase
473474
474475 :param base_url: The URL of the remote system
@@ -494,7 +495,7 @@ def __init__(self, base_url, username=None, password=None,
494495 :param check_connectivity: A boolean to determine whether the client immediately checks for
495496 connectivity to the base_url or not.
496497 :type check_connectivity: bool
497-
498+ :type https_adapter: requests.adpaters.HTTPAdapter
498499 """
499500
500501 self .__base_url = base_url .rstrip ('/' )
@@ -507,6 +508,8 @@ def __init__(self, base_url, username=None, password=None,
507508 self ._session = requests_unixsocket .Session ()
508509 else :
509510 self ._session = requests .Session ()
511+ if https_adapter :
512+ self ._session .mount ('https://' ,https_adapter )
510513 self ._timeout = timeout
511514 self ._max_retry = max_retry if max_retry is not None else 10
512515 self ._proxies = proxies
@@ -1079,7 +1082,8 @@ def __init__(self, base_url, username=None, password=None,
10791082 default_prefix = '/redfish/v1/' ,
10801083 sessionkey = None , capath = None ,
10811084 cafile = None , timeout = None ,
1082- max_retry = None , proxies = None , check_connectivity = True ):
1085+ max_retry = None , proxies = None , check_connectivity = True ,
1086+ https_adapter = None ):
10831087 """Initialize HttpClient
10841088
10851089 :param base_url: The url of the remote system
@@ -1105,14 +1109,15 @@ def __init__(self, base_url, username=None, password=None,
11051109 :param check_connectivity: A boolean to determine whether the client immediately checks for
11061110 connectivity to the base_url or not.
11071111 :type check_connectivity: bool
1108-
1112+ :param https_adapter session adapter for HTTPS
1113+ :type https_adapter: requests.adpaters.HTTPAdapter
11091114 """
11101115 super (HttpClient , self ).__init__ (base_url , username = username ,
11111116 password = password , default_prefix = default_prefix ,
11121117 sessionkey = sessionkey , capath = capath ,
11131118 cafile = cafile , timeout = timeout ,
11141119 max_retry = max_retry , proxies = proxies ,
1115- check_connectivity = check_connectivity )
1120+ check_connectivity = check_connectivity , https_adapter = https_adapter )
11161121
11171122 try :
11181123 self .login_url = self .root .Links .Sessions ['@odata.id' ]
@@ -1169,7 +1174,8 @@ def redfish_client(base_url=None, username=None, password=None,
11691174 default_prefix = '/redfish/v1/' ,
11701175 sessionkey = None , capath = None ,
11711176 cafile = None , timeout = None ,
1172- max_retry = None , proxies = None , check_connectivity = True ):
1177+ max_retry = None , proxies = None , check_connectivity = True ,
1178+ https_adapter = None ):
11731179 """Create and return appropriate REDFISH client instance."""
11741180 """ Instantiates appropriate Redfish object based on existing"""
11751181 """ configuration. Use this to retrieve a pre-configured Redfish object
@@ -1196,14 +1202,17 @@ def redfish_client(base_url=None, username=None, password=None,
11961202 :type proxies: dict
11971203 :param check_connectivity: A boolean to determine whether the client immediately checks for
11981204 connectivity to the base_url or not.
1199- :type check_connectivity: bool
1205+ :type check_connectivity: bo#ol
1206+ :param https_adapter session adapter for HTTPS
1207+ :type https_adapter: requests.adpaters.HTTPAdapter
12001208 :returns: a client object.
12011209
12021210 """
12031211 if "://" not in base_url :
1204- warnings .warn ("Scheme not specified for '{}'; adding 'https://'" .format (base_url ))
1205- base_url = "https://" + base_url
1212+ warnings .warn ("Scheme not specified for '{}'; adding 'https://'" .format (base_url ))
1213+ base_url = "https://" + base_url
12061214 return HttpClient (base_url = base_url , username = username , password = password ,
12071215 default_prefix = default_prefix , sessionkey = sessionkey ,
12081216 capath = capath , cafile = cafile , timeout = timeout ,
1209- max_retry = max_retry , proxies = proxies , check_connectivity = check_connectivity )
1217+ max_retry = max_retry , proxies = proxies , check_connectivity = check_connectivity ,
1218+ https_adapter = https_adapter )
0 commit comments