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