def __init__(self, port, key_file, cert_file): self.transport = VerifyingSafeTransport(key_file=key_file, cert_file=cert_file, ca_certs=CRT_FILE, cert_reqs=ssl.CERT_REQUIRED, timeout=1) self.proxy = xmlrpclib.ServerProxy('https://%s:%s' % (HOST, port), transport=self.transport)
class VerifyingClient: def __init__(self, port, key_file, cert_file): self.transport = VerifyingSafeTransport( key_file=key_file, cert_file=cert_file, ca_certs=CRT_FILE, cert_reqs=ssl.CERT_REQUIRED, timeout=1 ) self.proxy = xmlrpclib.ServerProxy("https://%s:%s" % (HOST, port), transport=self.transport) def add(self, numer1, number2): return self.proxy.add(numer1, number2) def close(self): if hasattr(self.transport, "close"): self.transport.close()
class VerifyingClient(): def __init__(self, port, key_file, cert_file): self.transport = VerifyingSafeTransport(key_file=key_file, cert_file=cert_file, ca_certs=CRT_FILE, cert_reqs=ssl.CERT_REQUIRED, timeout=1) self.proxy = xmlrpclib.ServerProxy('https://%s:%s' % (HOST, port), transport=self.transport) def add(self, numer1, number2): return self.proxy.add(numer1, number2) def close(self): if hasattr(self.transport, 'close'): self.transport.close()