Skip to content

Commit

Permalink
Switch to async def and await (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
cclauss authored and asvetlov committed Jul 4, 2016
1 parent 14b77d9 commit d32dbd9
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions examples/simple.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ def func(request):
return {'head': 'aiohttp_mako', 'text': 'Hello World!'}


@asyncio.coroutine
def init(loop):
async def init(loop):
app = web.Application(loop=loop)
lookup = aiohttp_mako.setup(app, input_encoding='utf-8',
output_encoding='utf-8',
Expand All @@ -19,7 +18,7 @@ def init(loop):
app.router.add_route('GET', '/', func)

handler = app.make_handler()
srv = yield from loop.create_server(handler, '127.0.0.1', 8080)
srv = await loop.create_server(handler, '127.0.0.1', 8080)
print("Server started at http://127.0.0.1:8080")
return srv, handler

Expand Down

0 comments on commit d32dbd9

Please sign in to comment.