diff options
Diffstat (limited to 'bottle.py')
-rwxr-xr-x | bottle.py | 21 |
1 files changed, 5 insertions, 16 deletions
@@ -3507,9 +3507,9 @@ class AsyncioServerAdapter(ServerAdapter): pass class AiohttpServer(AsyncioServerAdapter): - """ Untested. - aiohttp + """ Asynchronous HTTP client/server framework for asyncio https://pypi.python.org/pypi/aiohttp/ + https://pypi.org/project/aiohttp-wsgi/ """ def get_event_loop(self): @@ -3518,27 +3518,16 @@ class AiohttpServer(AsyncioServerAdapter): def run(self, handler): import asyncio - from aiohttp.wsgi import WSGIServerHttpProtocol + from aiohttp_wsgi.wsgi import serve self.loop = self.get_event_loop() asyncio.set_event_loop(self.loop) - protocol_factory = lambda: WSGIServerHttpProtocol( - handler, - readpayload=True, - loop=self.loop, - 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() + serve(handler, host=self.host, port=self.port) + class AiohttpUVLoopServer(AiohttpServer): """uvloop |