本文整理汇总了Python中cherrypy.wsgiserver.ssl_pyopenssl.pyOpenSSLAdapter方法的典型用法代码示例。如果您正苦于以下问题:Python ssl_pyopenssl.pyOpenSSLAdapter方法的具体用法?Python ssl_pyopenssl.pyOpenSSLAdapter怎么用?Python ssl_pyopenssl.pyOpenSSLAdapter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cherrypy.wsgiserver.ssl_pyopenssl
的用法示例。
在下文中一共展示了ssl_pyopenssl.pyOpenSSLAdapter方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: run
# 需要导入模块: from cherrypy.wsgiserver import ssl_pyopenssl [as 别名]
# 或者: from cherrypy.wsgiserver.ssl_pyopenssl import pyOpenSSLAdapter [as 别名]
def run(self, handler):
try:
# First try to use the new version
from cheroot.ssl.pyopenssl import pyOpenSSLAdapter
from cheroot import wsgi
server = wsgi.Server((self.host, self.port), handler, request_queue_size=32)
except Exception:
from cherrypy.wsgiserver.ssl_pyopenssl import pyOpenSSLAdapter
from cherrypy import wsgiserver
server = wsgiserver.CherryPyWSGIServer((self.host, self.port), handler, request_queue_size=32)
self.srv = server
# If cert variable is has a valid path, SSL will be used
# You can set it to None to disable SSL
server.ssl_adapter = pyOpenSSLAdapter(Config.REST_SSL_CERTFILE,
Config.REST_SSL_KEYFILE,
Config.REST_SSL_CA_CERTS)
try:
server.start()
finally:
server.stop()