@@ -1323,6 +1323,11 @@ def parse_response(self, response):
13231323class SafeTransport (Transport ):
13241324 """Handles an HTTPS transaction to an XML-RPC server."""
13251325
1326+ def __init__ (self , use_datetime = False , use_builtin_types = False , * ,
1327+ context = None ):
1328+ super ().__init__ (use_datetime = use_datetime , use_builtin_types = use_builtin_types )
1329+ self .context = context
1330+
13261331 # FIXME: mostly untested
13271332
13281333 def make_connection (self , host ):
@@ -1336,7 +1341,7 @@ def make_connection(self, host):
13361341 # host may be a string, or a (host, x509-dict) tuple
13371342 chost , self ._extra_headers , x509 = self .get_host_info (host )
13381343 self ._connection = host , http .client .HTTPSConnection (chost ,
1339- None , ** (x509 or {}))
1344+ None , context = self . context , ** (x509 or {}))
13401345 return self ._connection [1 ]
13411346
13421347##
@@ -1379,7 +1384,8 @@ class ServerProxy:
13791384 """
13801385
13811386 def __init__ (self , uri , transport = None , encoding = None , verbose = False ,
1382- allow_none = False , use_datetime = False , use_builtin_types = False ):
1387+ allow_none = False , use_datetime = False , use_builtin_types = False ,
1388+ * , context = None ):
13831389 # establish a "logical" server connection
13841390
13851391 # get the url
@@ -1393,10 +1399,13 @@ def __init__(self, uri, transport=None, encoding=None, verbose=False,
13931399 if transport is None :
13941400 if type == "https" :
13951401 handler = SafeTransport
1402+ extra_kwargs = {"context" : context }
13961403 else :
13971404 handler = Transport
1405+ extra_kwargs = {}
13981406 transport = handler (use_datetime = use_datetime ,
1399- use_builtin_types = use_builtin_types )
1407+ use_builtin_types = use_builtin_types ,
1408+ ** extra_kwargs )
14001409 self .__transport = transport
14011410
14021411 self .__encoding = encoding or 'utf-8'
0 commit comments