Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/uipath-platform/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "uipath-platform"
version = "0.1.0"
version = "0.1.1"
description = "HTTP client library for programmatic access to UiPath Platform"
readme = { file = "README.md", content-type = "text/markdown" }
requires-python = ">=3.11"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from ._execution_context import UiPathExecutionContext
from ._external_application_service import ExternalApplicationService
from ._folder_context import FolderContext, header_folder
from ._http_config import get_httpx_client_kwargs
from ._http_config import get_httpx_client_kwargs, is_ssl_verification_disabled
from ._models import Endpoint, RequestSpec
from ._service_url_overrides import inject_routing_headers, resolve_service_url
from ._span_utils import UiPathSpan, _SpanUtils
Expand Down Expand Up @@ -93,6 +93,7 @@
"UiPathUrl",
"user_agent_value",
"get_httpx_client_kwargs",
"is_ssl_verification_disabled",
"resource_override",
"header_folder",
"validate_pagination_params",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,16 @@ def create_ssl_context():
)


def is_ssl_verification_disabled() -> bool:
"""Check if SSL verification is disabled via UIPATH_DISABLE_SSL_VERIFY."""
return os.environ.get("UIPATH_DISABLE_SSL_VERIFY", "").lower() in (
"1",
"true",
"yes",
"on",
)


def get_httpx_client_kwargs(
headers: Dict[str, str] | None = None,
) -> Dict[str, Any]:
Expand All @@ -44,10 +54,8 @@ def get_httpx_client_kwargs(
Caller headers take priority on key conflicts.
"""
client_kwargs: Dict[str, Any] = {"follow_redirects": True, "timeout": 30.0}
disable_ssl_env = os.environ.get("UIPATH_DISABLE_SSL_VERIFY", "").lower()
disable_ssl_from_env = disable_ssl_env in ("1", "true", "yes", "on")

if disable_ssl_from_env:
if is_ssl_verification_disabled():
client_kwargs["verify"] = False
else:
client_kwargs["verify"] = create_ssl_context()
Expand Down
26 changes: 25 additions & 1 deletion packages/uipath-platform/tests/services/test_http_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
import pytest

from uipath.platform.common._config import ConfigurationManager
from uipath.platform.common._http_config import get_httpx_client_kwargs
from uipath.platform.common._http_config import (
get_httpx_client_kwargs,
is_ssl_verification_disabled,
)


@pytest.fixture(autouse=True)
Expand All @@ -12,6 +15,27 @@ def _clean_env(monkeypatch: pytest.MonkeyPatch) -> None:
monkeypatch.delenv("UIPATH_DISABLE_SSL_VERIFY", raising=False)


class TestIsSslVerificationDisabled:
"""Tests for is_ssl_verification_disabled()."""

def test_disabled_when_not_set(self) -> None:
assert is_ssl_verification_disabled() is False

@pytest.mark.parametrize("value", ["1", "true", "True", "TRUE", "yes", "on"])
def test_disabled_with_truthy_values(
self, monkeypatch: pytest.MonkeyPatch, value: str
) -> None:
monkeypatch.setenv("UIPATH_DISABLE_SSL_VERIFY", value)
assert is_ssl_verification_disabled() is True

@pytest.mark.parametrize("value", ["0", "false", "no", "off", ""])
def test_enabled_with_falsy_values(
self, monkeypatch: pytest.MonkeyPatch, value: str
) -> None:
monkeypatch.setenv("UIPATH_DISABLE_SSL_VERIFY", value)
assert is_ssl_verification_disabled() is False


class TestGetHttpxClientKwargsHeaders:
"""Tests for header merging in get_httpx_client_kwargs()."""

Expand Down
4 changes: 2 additions & 2 deletions packages/uipath-platform/uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions packages/uipath/uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading