diff --git a/packages/uipath-platform/pyproject.toml b/packages/uipath-platform/pyproject.toml index 09aa3f42c..eac9d3092 100644 --- a/packages/uipath-platform/pyproject.toml +++ b/packages/uipath-platform/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "uipath-platform" -version = "0.2.39" +version = "0.2.40" description = "HTTP client library for programmatic access to UiPath Platform" readme = { file = "README.md", content-type = "text/markdown" } requires-python = ">=3.11" diff --git a/packages/uipath-platform/src/uipath/platform/common/retry.py b/packages/uipath-platform/src/uipath/platform/common/retry.py index ff4b5a064..d229dd20a 100644 --- a/packages/uipath-platform/src/uipath/platform/common/retry.py +++ b/packages/uipath-platform/src/uipath/platform/common/retry.py @@ -6,7 +6,7 @@ import random -from httpx import ConnectTimeout, HTTPStatusError, Response, TimeoutException +from httpx import ConnectError, HTTPStatusError, Response, TimeoutException from tenacity import RetryCallState from ..errors import EnrichedException @@ -67,7 +67,8 @@ def extract_retry_after_from_chain(exception: BaseException) -> float | None: def is_retryable_platform_exception(exception: BaseException) -> bool: """Return True if the exception is transient and should be retried.""" - if isinstance(exception, (ConnectTimeout, TimeoutException)): + # A failed connect never sent the request, so any method is safe to retry. + if isinstance(exception, (ConnectError, TimeoutException)): return True if isinstance(exception, EnrichedException): return exception.status_code in RETRYABLE_STATUS_CODES diff --git a/packages/uipath-platform/tests/services/test_retry.py b/packages/uipath-platform/tests/services/test_retry.py index ab893f042..14d21bcc4 100644 --- a/packages/uipath-platform/tests/services/test_retry.py +++ b/packages/uipath-platform/tests/services/test_retry.py @@ -149,6 +149,10 @@ def test_timeout_exception(self): err = httpx.TimeoutException("timed out") assert is_retryable_platform_exception(err) is True + def test_connect_error(self): + err = httpx.ConnectError("[Errno 104] Connection reset by peer") + assert is_retryable_platform_exception(err) is True + def test_enriched_408(self): http_err = _make_http_status_error(408) err = EnrichedException(http_err) diff --git a/packages/uipath-platform/uv.lock b/packages/uipath-platform/uv.lock index 07ff10280..498094a3c 100644 --- a/packages/uipath-platform/uv.lock +++ b/packages/uipath-platform/uv.lock @@ -1095,7 +1095,7 @@ dev = [ [[package]] name = "uipath-platform" -version = "0.2.39" +version = "0.2.40" source = { editable = "." } dependencies = [ { name = "anyio" }, diff --git a/packages/uipath/uv.lock b/packages/uipath/uv.lock index b3cbea901..4724d0e3f 100644 --- a/packages/uipath/uv.lock +++ b/packages/uipath/uv.lock @@ -2762,7 +2762,7 @@ wheels = [ [[package]] name = "uipath-platform" -version = "0.2.39" +version = "0.2.40" source = { editable = "../uipath-platform" } dependencies = [ { name = "anyio" },