summaryrefslogtreecommitdiff
path: root/bottle.py
diff options
context:
space:
mode:
Diffstat (limited to 'bottle.py')
-rwxr-xr-xbottle.py21
1 files changed, 5 insertions, 16 deletions
diff --git a/bottle.py b/bottle.py
index cc42077..9368c46 100755
--- a/bottle.py
+++ b/bottle.py
@@ -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