@@ -1324,6 +1324,11 @@ def parse_response(self, response):
13241324class SafeTransport (Transport ):
13251325 """Handles an HTTPS transaction to an XML-RPC server."""
13261326
1327+ def __init__ (self , use_datetime = False , use_builtin_types = False , * ,
1328+ context = None ):
1329+ super ().__init__ (use_datetime = use_datetime , use_builtin_types = use_builtin_types )
1330+ self .context = context
1331+
13271332 # FIXME: mostly untested
13281333
13291334 def make_connection (self , host ):
@@ -1337,7 +1342,7 @@ def make_connection(self, host):
13371342 # host may be a string, or a (host, x509-dict) tuple
13381343 chost , self ._extra_headers , x509 = self .get_host_info (host )
13391344 self ._connection = host , http .client .HTTPSConnection (chost ,
1340- None , ** (x509 or {}))
1345+ None , context = self . context , ** (x509 or {}))
13411346 return self ._connection [1 ]
13421347
13431348##
@@ -1380,7 +1385,8 @@ class ServerProxy:
13801385 """
13811386
13821387 def __init__ (self , uri , transport = None , encoding = None , verbose = False ,
1383- allow_none = False , use_datetime = False , use_builtin_types = False ):
1388+ allow_none = False , use_datetime = False , use_builtin_types = False ,
1389+ * , context = None ):
13841390 # establish a "logical" server connection
13851391
13861392 # get the url
@@ -1394,10 +1400,13 @@ def __init__(self, uri, transport=None, encoding=None, verbose=False,
13941400 if transport is None :
13951401 if type == "https" :
13961402 handler = SafeTransport
1403+ extra_kwargs = {"context" : context }
13971404 else :
13981405 handler = Transport
1406+ extra_kwargs = {}
13991407 transport = handler (use_datetime = use_datetime ,
1400- use_builtin_types = use_builtin_types )
1408+ use_builtin_types = use_builtin_types ,
1409+ ** extra_kwargs )
14011410 self .__transport = transport
14021411
14031412 self .__encoding = encoding or 'utf-8'
0 commit comments