diff --git a/src/evohomeasync/auth.py b/src/evohomeasync/auth.py index 710ea37..c95145f 100644 --- a/src/evohomeasync/auth.py +++ b/src/evohomeasync/auth.py @@ -213,6 +213,7 @@ def __init__( async def _headers(self, headers: dict[str, str] | None = None) -> dict[str, str]: """Ensure the authorization header has a valid session id.""" - return (headers or HEADERS_BASE) | { + headers = HEADERS_BASE | (headers or {}) + return headers | { "sessionId": await self._get_session_id(), } diff --git a/src/evohomeasync2/auth.py b/src/evohomeasync2/auth.py index 77c1fc5..d9d34c8 100644 --- a/src/evohomeasync2/auth.py +++ b/src/evohomeasync2/auth.py @@ -269,6 +269,7 @@ def __init__( async def _headers(self, headers: dict[str, str] | None = None) -> dict[str, str]: """Ensure the authorization header has a valid access token.""" - return (headers or HEADERS_BASE) | { + headers = HEADERS_BASE | (headers or {}) + return headers | { "Authorization": "bearer " + await self._get_access_token(), } diff --git a/tests/tests_rf/test_v2_urlz.py b/tests/tests_rf/test_v2_urlz.py index 3400c5f..4eec5cb 100644 --- a/tests/tests_rf/test_v2_urlz.py +++ b/tests/tests_rf/test_v2_urlz.py @@ -131,6 +131,8 @@ async def test_tcs_urls( json={"SystemMode": "Auto", "Permanent": True}, ) # type: ignore[assignment] + # factory_tcs_status()(task) # {'id': '1668279943'} + @skipif_auth_failed @pytest.mark.skipif(not _DBG_USE_REAL_AIOHTTP, reason="requires vendor's webserver")