Skip to content

Commit

Permalink
Make aio_manager compatible with aiohttp>=2.3
Browse files Browse the repository at this point in the history
  • Loading branch information
webknjaz committed Oct 27, 2017
1 parent cdbd8f3 commit 8c683d4
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion aio_manager/commands/runserver.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,20 @@ def run(self, app, args):
try:
loop.run_forever()
except KeyboardInterrupt:
loop.run_until_complete(handler.finish_connections())
try:
"""
``finish_connection()`` is deprecated since aiohttp v1.2
It's fully removed from aiohttp >= v2.3:
https://github.com/aio-libs/aiohttp/pull/2006
"""
shutdown_coro = handler.finish_connections()
except AttributeError:
"""
``finish_connection()`` is an alias
for ``shutdown()`` in aiohttp >=1.2,<2.3.
"""
shutdown_coro = handler.shutdown()
loop.run_until_complete(shutdown_coro)

def configure_parser(self, parser):
super().configure_parser(parser)
Expand Down

0 comments on commit 8c683d4

Please sign in to comment.