當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。