Python eventlet.wrap_ssl() Examples
The following are 5
code examples of eventlet.wrap_ssl().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
eventlet
, or try the search function
.
Example #1
Source File: test_wsgi.py From oslo.service with Apache License 2.0 | 6 votes |
def requesting(host, port, ca_certs=None, method="POST", content_type="application/x-www-form-urlencoded", address_familly=socket.AF_INET): frame = bytes("{verb} / HTTP/1.1\r\n\r\n".format(verb=method), "utf-8") with socket.socket(address_familly, socket.SOCK_STREAM) as sock: if ca_certs: with eventlet.wrap_ssl(sock, ca_certs=ca_certs) as wrappedSocket: wrappedSocket.connect((host, port)) wrappedSocket.send(frame) data = wrappedSocket.recv(1024).decode() return data else: sock.connect((host, port)) sock.send(frame) data = sock.recv(1024).decode() return data
Example #2
Source File: geventlet.py From jbox with MIT License | 5 votes |
def handle(self, listener, client, addr): if self.cfg.is_ssl: client = eventlet.wrap_ssl(client, server_side=True, **self.cfg.ssl_options) super(EventletWorker, self).handle(listener, client, addr)
Example #3
Source File: impl_nsd4.py From designate with Apache License 2.0 | 5 votes |
def _command(self, command): sock = eventlet.wrap_ssl( eventlet.connect((self.host, self.port)), keyfile=self.keyfile, certfile=self.certfile) stream = sock.makefile() stream.write('%s %s\n' % (self.NSDCT_VERSION, command)) stream.flush() result = stream.read() stream.close() sock.close() return result
Example #4
Source File: geventlet.py From Flask-P2P with MIT License | 5 votes |
def handle(self, listener, client, addr): if self.cfg.is_ssl: client = eventlet.wrap_ssl(client, server_side=True, **self.cfg.ssl_options) super(EventletWorker, self).handle(listener, client, addr)
Example #5
Source File: api.py From st2 with Apache License 2.0 | 5 votes |
def _run_server(): host = cfg.CONF.auth.host port = cfg.CONF.auth.port use_ssl = cfg.CONF.auth.use_ssl cert_file_path = os.path.realpath(cfg.CONF.auth.cert) key_file_path = os.path.realpath(cfg.CONF.auth.key) if use_ssl and not os.path.isfile(cert_file_path): raise ValueError('Certificate file "%s" doesn\'t exist' % (cert_file_path)) if use_ssl and not os.path.isfile(key_file_path): raise ValueError('Private key file "%s" doesn\'t exist' % (key_file_path)) socket = eventlet.listen((host, port)) if use_ssl: socket = eventlet.wrap_ssl(socket, certfile=cert_file_path, keyfile=key_file_path, server_side=True) LOG.info('ST2 Auth API running in "%s" auth mode', cfg.CONF.auth.mode) LOG.info('(PID=%s) ST2 Auth API is serving on %s://%s:%s.', os.getpid(), 'https' if use_ssl else 'http', host, port) wsgi.server(socket, app.setup_app(), log=LOG, log_output=False) return 0