当前位置: 首页>>代码示例>>Python>>正文


Python wsgi.WSGIServerHttpProtocol方法代码示例

本文整理汇总了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() 
开发者ID:harryparkdotio,项目名称:dabdabrevolution,代码行数:24,代码来源:bottle.py

示例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() 
开发者ID:warriorframework,项目名称:warriorframework,代码行数:24,代码来源:bottle.py

示例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) 
开发者ID:RoseOu,项目名称:flasky,代码行数:15,代码来源:_gaiohttp.py

示例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) 
开发者ID:squeaky-pl,项目名称:zenchmarks,代码行数:11,代码来源:worker.py


注:本文中的aiohttp.wsgi.WSGIServerHttpProtocol方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。