1 """Leverage curl to make XMLRPC requests that check the server's credentials."""
8 class CertificateCheckingSafeTransport (xmlrpclib.Transport):
10 def __init__(self, cacert, timeout):
12 self.timeout = timeout
14 def request(self, host, handler, request_body, verbose=0):
15 self.verbose = verbose
16 url='https://%s%s' % (host, handler)
17 # this might raise an xmlrpclib.Protocolerror exception
18 contents = curlwrapper.retrieve(url,
20 postdata = request_body,
21 timeout = self.timeout)
22 return xmlrpclib.loads(contents)[0]
24 class ServerProxy(xmlrpclib.ServerProxy):
26 def __init__(self, uri, cacert, timeout = 300, **kwds):
27 xmlrpclib.ServerProxy.__init__(self, uri,
28 CertificateCheckingSafeTransport(cacert, timeout),