Skip to content

Commit 52e0b91

Browse files
Fix custom cookies example (#9321) (#9324)
(cherry picked from commit a4b148e)
1 parent 609c6e3 commit 52e0b91

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

docs/client_advanced.rst

+7-7
Original file line numberDiff line numberDiff line change
@@ -82,14 +82,14 @@ parameter of :class:`ClientSession` constructor::
8282
between multiple requests::
8383

8484
async with aiohttp.ClientSession() as session:
85-
await session.get(
86-
'http://httpbin.org/cookies/set?my_cookie=my_value')
87-
filtered = session.cookie_jar.filter_cookies(
88-
'http://httpbin.org')
89-
assert filtered['my_cookie'].value == 'my_value'
90-
async with session.get('http://httpbin.org/cookies') as r:
85+
async with session.get(
86+
"http://httpbin.org/cookies/set?my_cookie=my_value",
87+
allow_redirects=False
88+
) as resp:
89+
assert resp.cookies["my_cookie"].value == "my_value"
90+
async with session.get("http://httpbin.org/cookies") as r:
9191
json_body = await r.json()
92-
assert json_body['cookies']['my_cookie'] == 'my_value'
92+
assert json_body["cookies"]["my_cookie"] == "my_value"
9393

9494
Response Headers and Cookies
9595
----------------------------

0 commit comments

Comments
 (0)