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