Updated examples in-line with response docs
This commit is contained in:
parent
c30437448b
commit
9d3bb4a37a
|
@ -10,7 +10,7 @@ async def fetch(session, url):
|
||||||
Use session object to perform 'get' request on url
|
Use session object to perform 'get' request on url
|
||||||
"""
|
"""
|
||||||
async with session.get(url) as result:
|
async with session.get(url) as result:
|
||||||
return await result.text()
|
return await result.json()
|
||||||
|
|
||||||
|
|
||||||
@app.route('/')
|
@app.route('/')
|
||||||
|
|
|
@ -14,4 +14,4 @@ async def test(request):
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
app.run(host="0.0.0.0", port=8080)
|
app.run(host="0.0.0.0", port=8000)
|
|
@ -12,7 +12,7 @@ async def test(request):
|
||||||
return response.json({"answer": "42"})
|
return response.json({"answer": "42"})
|
||||||
|
|
||||||
asyncio.set_event_loop(uvloop.new_event_loop())
|
asyncio.set_event_loop(uvloop.new_event_loop())
|
||||||
server = app.create_server(host="0.0.0.0", port=8080)
|
server = app.create_server(host="0.0.0.0", port=8000)
|
||||||
loop = asyncio.get_event_loop()
|
loop = asyncio.get_event_loop()
|
||||||
task = asyncio.ensure_future(server)
|
task = asyncio.ensure_future(server)
|
||||||
signal(SIGINT, lambda s, f: loop.stop())
|
signal(SIGINT, lambda s, f: loop.stop())
|
||||||
|
|
Loading…
Reference in New Issue
Block a user