diff --git a/hahomematic/client/json_rpc.py b/hahomematic/client/json_rpc.py index fdbcb431..3234d585 100644 --- a/hahomematic/client/json_rpc.py +++ b/hahomematic/client/json_rpc.py @@ -8,9 +8,16 @@ import logging import os from pathlib import Path +from ssl import SSLContext from typing import Any, Final -from aiohttp import ClientConnectorCertificateError, ClientError, ClientResponse, ClientSession +from aiohttp import ( + ClientConnectorCertificateError, + ClientError, + ClientResponse, + ClientSession, + ClientTimeout, +) import orjson from hahomematic import central as hmcu, config @@ -108,7 +115,7 @@ def __init__( self._password: Final = password self._looper = Looper() self._tls: Final = tls - self._tls_context: Final = get_tls_context(verify_tls) if tls else None + self._tls_context: Final[SSLContext | bool] = get_tls_context(verify_tls) if tls else False self._url: Final = f"{device_url}{PATH_JSON_RPC}" self._script_cache: Final[dict[str, str]] = {} self._last_session_id_refresh: datetime | None = None @@ -312,7 +319,7 @@ async def _do_post( self._url, data=payload, headers=headers, - timeout=config.TIMEOUT, + timeout=ClientTimeout(total=config.TIMEOUT), ssl=self._tls_context, ) ) is None: diff --git a/requirements_test.txt b/requirements_test.txt index 0f594620..deb2a164 100644 --- a/requirements_test.txt +++ b/requirements_test.txt @@ -6,7 +6,8 @@ freezegun==1.5.1 mypy-dev==1.12.0a3 pip==24.2 pre-commit==3.8.0 -pydantic==2.8.2 +pur==7.3.2 +pydantic==2.9.0 pydevccu==0.1.8 pylint-per-file-ignores==1.3.2 pylint-strict-informational==0.1 @@ -19,4 +20,4 @@ pytest-socket==0.7.0 pytest-timeout==2.3.1 pytest==8.3.2 types-python-slugify==8.0.2.20240310 -uv==0.4.5 +uv==0.4.7 diff --git a/requirements_test_pre_commit.txt b/requirements_test_pre_commit.txt index 73893044..12bf4755 100644 --- a/requirements_test_pre_commit.txt +++ b/requirements_test_pre_commit.txt @@ -1,4 +1,4 @@ bandit==1.7.9 codespell==2.3.0 -ruff==0.6.3 +ruff==0.6.4 yamllint==1.35.1