From 7f7b12af3b684396738e52762d64b7eb58e7930c Mon Sep 17 00:00:00 2001 From: Julien Palard Date: Thu, 8 Mar 2018 15:36:54 +0100 Subject: [PATCH] doc fix: Response does not take positional parameters. (#2815) --- docs/web_advanced.rst | 4 ++-- docs/web_reference.rst | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/web_advanced.rst b/docs/web_advanced.rst index a6803ff341a..0c7363a4ed0 100644 --- a/docs/web_advanced.rst +++ b/docs/web_advanced.rst @@ -43,7 +43,7 @@ For example the following snippet is not safe:: async def handler(request): await asyncio.shield(write_to_redis(request)) await asyncio.shield(write_to_postgres(request)) - return web.Response('OK') + return web.Response(text='OK') Cancellation might be occurred just after saving data in REDIS, ``write_to_postgres`` will be not called. @@ -53,7 +53,7 @@ spawned tasks:: async def handler(request): request.loop.create_task(write_to_redis(request)) - return web.Response('OK') + return web.Response(text='OK') In this case errors from ``write_to_redis`` are not awaited, it leads to many asyncio log messages *Future exception was never retrieved* diff --git a/docs/web_reference.rst b/docs/web_reference.rst index 7669b5d0941..6208385d0b3 100644 --- a/docs/web_reference.rst +++ b/docs/web_reference.rst @@ -503,7 +503,7 @@ The common case for sending an answer from :class:`Response` instance:: def handler(request): - return Response("All right!") + return Response(text="All right!") Response classes are :obj:`dict` like objects, allowing them to be used for :ref:`sharing