Skip to content

Commit

Permalink
Fix storing normalized cookie with aiohttp 3.10
Browse files Browse the repository at this point in the history
aiohttp 3.10 and more specifically aio-libs/aiohttp#7944 changed the way cookies are handled. Previously, the domain did not have to be part of the cookie jar for a cookie to be used. As this was changed in 3.10, we now need to pass in the response URL when updating the cookie jar, otherwise the domain will not be part of the stored cookie, and consequently will not be used for the next request.

Fixes home-assistant/core#123310.
  • Loading branch information
slovdahl authored Aug 16, 2024
1 parent 93df39e commit 7dbd32f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pybravia/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ async def send_req(
cookies = response.headers.getall("set-cookie", None)
if cookies:
normalized_cookies = normalize_cookies(cookies)
self._session.cookie_jar.update_cookies(normalized_cookies)
self._session.cookie_jar.update_cookies(cookies=normalized_cookies, response_url=response.url)

if response.status == 200:
result = await response.json() if json else True
Expand Down

0 comments on commit 7dbd32f

Please sign in to comment.