diff --git a/docs/faq.rst b/docs/faq.rst index 706c27912b9..07ebdec42f6 100644 --- a/docs/faq.rst +++ b/docs/faq.rst @@ -203,7 +203,7 @@ If your system has several IP interfaces you may choose one which will be used used to bind socket locally:: conn = aiohttp.TCPConnector(local_addr=('127.0.0.1, 0), loop=loop) - with aiohttp.ClientSession(connector=conn) as session: + async with aiohttp.ClientSession(connector=conn) as session: ... .. seealso:: :class:`aiohttp.TCPConnector` and ``local_addr`` parameter. diff --git a/examples/curl.py b/examples/curl.py index 8cbb94f33d5..bf95cdf379b 100755 --- a/examples/curl.py +++ b/examples/curl.py @@ -15,7 +15,7 @@ def curl(url): print('Downloaded: %s' % len(chunk)) response.close() - session.close() + yield from session.close() if __name__ == '__main__':