From 121e059b3d37dc88c621ab1c71a5ed5bb3305928 Mon Sep 17 00:00:00 2001 From: Raphael Deem Date: Sat, 21 Jan 2017 11:26:03 -0800 Subject: [PATCH] update aiohttp example --- examples/aiohttp_example.py | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/examples/aiohttp_example.py b/examples/aiohttp_example.py index 8e7892a7..56400f42 100644 --- a/examples/aiohttp_example.py +++ b/examples/aiohttp_example.py @@ -1,12 +1,9 @@ from sanic import Sanic from sanic.response import json -import uvloop +import asyncio import aiohttp -#Create an event loop manually so that we can use it for both sanic & aiohttp -loop = uvloop.new_event_loop() - app = Sanic(__name__) async def fetch(session, url): @@ -24,10 +21,9 @@ async def test(request): """ url = "https://api.github.com/repos/channelcat/sanic" - async with aiohttp.ClientSession(loop=loop) as session: + async with aiohttp.ClientSession() as session: response = await fetch(session, url) return json(response) -app.run(host="0.0.0.0", port=8000, loop=loop) - +app.run(host="0.0.0.0", port=8000, workers=2)