Skip to content

Commit

Permalink
Fix custom cookies example (#9321) (#9324)
Browse files Browse the repository at this point in the history
(cherry picked from commit a4b148e)
  • Loading branch information
Dreamsorcerer authored Sep 28, 2024
1 parent 609c6e3 commit 52e0b91
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions docs/client_advanced.rst
Original file line number Diff line number Diff line change
Expand Up @@ -82,14 +82,14 @@ parameter of :class:`ClientSession` constructor::
between multiple requests::

async with aiohttp.ClientSession() as session:
await session.get(
'http://httpbin.org/cookies/set?my_cookie=my_value')
filtered = session.cookie_jar.filter_cookies(
'http://httpbin.org')
assert filtered['my_cookie'].value == 'my_value'
async with session.get('http://httpbin.org/cookies') as r:
async with session.get(
"http://httpbin.org/cookies/set?my_cookie=my_value",
allow_redirects=False
) as resp:
assert resp.cookies["my_cookie"].value == "my_value"
async with session.get("http://httpbin.org/cookies") as r:
json_body = await r.json()
assert json_body['cookies']['my_cookie'] == 'my_value'
assert json_body["cookies"]["my_cookie"] == "my_value"

Response Headers and Cookies
----------------------------
Expand Down

0 comments on commit 52e0b91

Please sign in to comment.