From ea28b451256863e7bdf641ef094bf3e6c5ebb22b Mon Sep 17 00:00:00 2001 From: Francesco Dipietromaria Date: Wed, 6 May 2026 10:14:07 +0000 Subject: [PATCH 1/2] fix: correct sync request timeout from 30000 to 30 seconds The `requests.request()` `timeout` parameter is expressed in seconds, not milliseconds. The previous value of 30000 meant ~8 hours, so a hung connection would block the caller indefinitely instead of failing fast. Align with a 30 second timeout. --- ariston/ariston_api.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ariston/ariston_api.py b/ariston/ariston_api.py index 465e078..4e91ed8 100644 --- a/ariston/ariston_api.py +++ b/ariston/ariston_api.py @@ -482,7 +482,7 @@ def __request( params, ) response = requests.request( - method, path, params=params, json=body, headers=headers, timeout=30000 + method, path, params=params, json=body, headers=headers, timeout=30 ) if not response.ok: match response.status_code: From b891fa5178e6a14af683b87b85c2c8bfc08ed1bf Mon Sep 17 00:00:00 2001 From: Francesco Dipietromaria Date: Fri, 13 Nov 2026 10:08:20 +0100 Subject: [PATCH 2/2] test: assert sync requests use a 30 second timeout Check the timeout kwarg passed to requests.request so a regression to 30000 (milliseconds mistaken for seconds) is caught. Co-Authored-By: Claude Sonnet 5.5 --- tests/test_ariston_api.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/test_ariston_api.py b/tests/test_ariston_api.py index c603d0f..71758c7 100644 --- a/tests/test_ariston_api.py +++ b/tests/test_ariston_api.py @@ -91,6 +91,10 @@ def test_login_token_is_sent_with_followup_request(self): self.assertEqual(devices, [{"gw": "gateway-1"}]) login_call, devices_call = request.call_args_list + # requests expects seconds: a regression to milliseconds (30000) would + # let a hung connection block the caller for hours. + self.assertEqual(login_call.kwargs["timeout"], 30) + self.assertEqual(devices_call.kwargs["timeout"], 30) self.assertEqual(login_call.args[0], "POST") self.assertEqual( login_call.kwargs["json"],