本文整理汇总了Python中aiohttp.wsgi.WSGIServerHttpProtocol方法的典型用法代码示例。如果您正苦于以下问题:Python wsgi.WSGIServerHttpProtocol方法的具体用法?Python wsgi.WSGIServerHttpProtocol怎么用?Python wsgi.WSGIServerHttpProtocol使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类aiohttp.wsgi
的用法示例。
在下文中一共展示了wsgi.WSGIServerHttpProtocol方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: run
# 需要导入模块: from aiohttp import wsgi [as 别名]
# 或者: from aiohttp.wsgi import WSGIServerHttpProtocol [as 别名]
def run(self, handler):
import asyncio
from aiohttp.wsgi import WSGIServerHttpProtocol
self.loop = self.get_event_loop()
asyncio.set_event_loop(self.loop)
protocol_factory = lambda: WSGIServerHttpProtocol(
handler,
readpayload=True,
debug=(not self.quiet))
self.loop.run_until_complete(self.loop.create_server(protocol_factory,
self.host,
self.port))
if 'BOTTLE_CHILD' in os.environ:
import signal
signal.signal(signal.SIGINT, lambda s, f: self.loop.stop())
try:
self.loop.run_forever()
except KeyboardInterrupt:
self.loop.stop()
示例2: run
# 需要导入模块: from aiohttp import wsgi [as 别名]
# 或者: from aiohttp.wsgi import WSGIServerHttpProtocol [as 别名]
def run(self, handler):
import asyncio
from aiohttp.wsgi import WSGIServerHttpProtocol
self.loop = asyncio.new_event_loop()
asyncio.set_event_loop(self.loop)
protocol_factory = lambda: WSGIServerHttpProtocol(
handler,
readpayload=True,
debug=(not self.quiet))
self.loop.run_until_complete(self.loop.create_server(protocol_factory,
self.host,
self.port))
if 'BOTTLE_CHILD' in os.environ:
import signal
signal.signal(signal.SIGINT, lambda s, f: self.loop.stop())
try:
self.loop.run_forever()
except KeyboardInterrupt:
self.loop.stop()
示例3: factory
# 需要导入模块: from aiohttp import wsgi [as 别名]
# 或者: from aiohttp.wsgi import WSGIServerHttpProtocol [as 别名]
def factory(self, wsgi, addr):
# are we in debug level
is_debug = self.log.loglevel == logging.DEBUG
proto = WSGIServerHttpProtocol(
wsgi, readpayload=True,
loop=self.loop,
log=self.log,
debug=is_debug,
keep_alive=self.cfg.keepalive,
access_log=self.log.access_log,
access_log_format=self.cfg.access_log_format)
return self.wrap_protocol(proto)
示例4: __call__
# 需要导入模块: from aiohttp import wsgi [as 别名]
# 或者: from aiohttp.wsgi import WSGIServerHttpProtocol [as 别名]
def __call__(self):
return WSGIServerHttpProtocol(
self.handler, readpayload=True,
loop=self._loop,
logger=self.worker.log,
debug=self.worker.log.loglevel == logging.DEBUG,
keep_alive=self.worker.cfg.keepalive,
access_log=self.worker.log.access_log,
access_log_format=self.access_log_format)