Skip to content

Commit 80de8a2

Browse files
committed
Migrate to using aiohttp
1 parent b43aee2 commit 80de8a2

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

onvif/zeep_aiohttp.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,13 +97,13 @@ def _aiohttp_to_httpx_response(
9797

9898
# Store cookies if any
9999
if aiohttp_response.cookies:
100-
for cookie in aiohttp_response.cookies.values():
100+
for name, cookie in aiohttp_response.cookies.items():
101101
# httpx.Cookies.set only accepts name, value, domain, and path
102102
httpx_response.cookies.set(
103-
cookie.key,
103+
name,
104104
cookie.value,
105-
domain=cookie.get("domain", ""),
106-
path=cookie.get("path", "/"),
105+
domain=cookie.get("domain") or "",
106+
path=cookie.get("path") or "/",
107107
)
108108

109109
return httpx_response

tests/test_zeep_transport.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -418,14 +418,13 @@ async def test_cookies_in_httpx_response():
418418

419419
# Mock cookies
420420
mock_cookie = Mock()
421-
mock_cookie.key = "session"
422421
mock_cookie.value = "abc123"
423422
mock_cookie.get.side_effect = lambda k: {"domain": ".example.com", "path": "/"}.get(
424423
k
425424
)
426425

427426
mock_cookies = Mock()
428-
mock_cookies.values.return_value = [mock_cookie]
427+
mock_cookies.items.return_value = [("session", mock_cookie)]
429428

430429
# Mock response with cookies
431430
mock_aiohttp_response = Mock(spec=aiohttp.ClientResponse)

0 commit comments

Comments
 (0)