本文整理汇总了Python中cherrypy.wsgiserver.CherryPyWSGIServer.ssl_module方法的典型用法代码示例。如果您正苦于以下问题:Python CherryPyWSGIServer.ssl_module方法的具体用法?Python CherryPyWSGIServer.ssl_module怎么用?Python CherryPyWSGIServer.ssl_module使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cherrypy.wsgiserver.CherryPyWSGIServer
的用法示例。
在下文中一共展示了CherryPyWSGIServer.ssl_module方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: run
# 需要导入模块: from cherrypy.wsgiserver import CherryPyWSGIServer [as 别名]
# 或者: from cherrypy.wsgiserver.CherryPyWSGIServer import ssl_module [as 别名]
def run(self, handler):
server = CherryPyWSGIServer((self.host, self.port), handler, server_name='localhost')
"""
openssl genrsa -out privkey.pem 1024
openssl req -new -x509 -key privkey.pem -out cacert.pem -days 1095
"""
crt = '/etc/coinbend/cacert.pem'
key = '/etc/coinbend/privkey.pem'
#ca = '/etc/ssl/intermediate.crt'
server.ssl_module = "pyopenssl"
server.ssl_adapter = PatchBuiltinSSLAdapter(crt, key)
# fucking p.o.s. cherry does NOT support prebuilt ssl contexts
#server.ssl_adapter.context = sc
try:
server.start()
finally:
server.stop()