From cc0bdaecd84f9bd57bb3e612f313fa003429b882 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 18 Mar 2026 01:25:15 +0000 Subject: [PATCH 1/3] Initial plan From b42c5090990837ecbf48f5e9c51de7496c4d8945 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 18 Mar 2026 01:28:15 +0000 Subject: [PATCH 2/3] ENH: Add explicit timeouts to ThrustCurve API requests Co-authored-by: MateusStano <69485049+MateusStano@users.noreply.github.com> --- rocketpy/motors/motor.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/rocketpy/motors/motor.py b/rocketpy/motors/motor.py index 373154512..ea42dd71c 100644 --- a/rocketpy/motors/motor.py +++ b/rocketpy/motors/motor.py @@ -1946,8 +1946,11 @@ def _call_thrustcurve_api(name: str, no_cache: bool = False): # pylint: disable ------ ValueError If no motor is found or if the downloaded .eng data is missing. + requests.exceptions.Timeout + If a search or download request to the ThrustCurve API exceeds the + timeout limit (5 s connect / 30 s read). requests.exceptions.RequestException - If a network or HTTP error occurs during the API call. + If any other network or HTTP error occurs during the API call. Notes ----- @@ -1973,8 +1976,13 @@ def _call_thrustcurve_api(name: str, no_cache: bool = False): # pylint: disable ) base_url = "https://www.thrustcurve.org/api/v1" + _timeout = (5, 30) # (connect timeout, read timeout) in seconds # Step 1. Search motor - response = requests.get(f"{base_url}/search.json", params={"commonName": name}) + response = requests.get( + f"{base_url}/search.json", + params={"commonName": name}, + timeout=_timeout, + ) response.raise_for_status() data = response.json() @@ -1994,6 +2002,7 @@ def _call_thrustcurve_api(name: str, no_cache: bool = False): # pylint: disable dl_response = requests.get( f"{base_url}/download.json", params={"motorIds": motor_id, "format": "RASP", "data": "file"}, + timeout=_timeout, ) dl_response.raise_for_status() dl_data = dl_response.json() From 3aaa71c12f189ac03c244db36890bdc015651f1d Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 18 Mar 2026 01:56:58 +0000 Subject: [PATCH 3/3] DOC: Add timeout fix PR to changelog Co-authored-by: MateusStano <69485049+MateusStano@users.noreply.github.com> --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e62f91e2c..b90f46589 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -40,7 +40,7 @@ Attention: The newest changes should be on top --> ### Fixed -- +- BUG: Add explicit timeouts to ThrustCurve API requests [#935](https://github.com/RocketPy-Team/RocketPy/pull/935) ## [v1.12.0] - 2026-03-08