Skip to content
Merged
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.0.12"
version = "0.0.13"
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,10 +18,10 @@
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 ._models import Endpoint, RequestSpec
from ._service_url_overrides import inject_routing_headers, resolve_service_url
from ._span_utils import UiPathSpan, _SpanUtils
from ._ssl_context import get_httpx_client_kwargs
from ._url import UiPathUrl
from ._user_agent import user_agent_value
from .auth import TokenData
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
from ..errors import EnrichedException
from ._config import UiPathApiConfig
from ._execution_context import UiPathExecutionContext
from ._http_config import get_httpx_client_kwargs
from ._service_url_overrides import inject_routing_headers, resolve_service_url
from ._ssl_context import get_httpx_client_kwargs
from ._url import UiPathUrl
from ._user_agent import user_agent_value
from .constants import HEADER_USER_AGENT
Expand Down
20 changes: 20 additions & 0 deletions packages/uipath-platform/src/uipath/platform/common/_config.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import os
from functools import cached_property
from pathlib import Path

from pydantic import BaseModel
Expand Down Expand Up @@ -132,11 +133,30 @@ def studio_metadata_file_path(self) -> Path:

return Path(".uipath", STUDIO_METADATA_FILE)

@property
def licensing_context(self) -> str | None:
return self._read_internal_argument("licensingContext")

@property
def is_tracing_enabled(self) -> bool:
from uipath.platform.common.constants import ENV_TRACING_ENABLED

return os.getenv(ENV_TRACING_ENABLED, "true").lower() == "true"

def _read_internal_argument(self, key: str) -> str | None:
internal_args = self._internal_arguments
return internal_args.get(key) if internal_args else None

@cached_property
def _internal_arguments(self) -> dict[str, str] | None:
import json

try:
with open(self.config_file_path, "r") as f:
data = json.load(f)
return data.get("runtime", {}).get("internalArguments")
except (FileNotFoundError, json.JSONDecodeError):
return None


UiPathConfig = ConfigurationManager()
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
import httpx

from ._config import UiPathConfig
from ._http_config import get_httpx_client_kwargs
from ._service_url_overrides import resolve_service_url
from ._ssl_context import get_httpx_client_kwargs

loggger = logging.getLogger(__name__)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from httpx import HTTPStatusError, Request

from ..errors import EnrichedException
from ._ssl_context import get_httpx_client_kwargs
from ._http_config import get_httpx_client_kwargs
from .auth import TokenData
from .constants import ENV_BASE_URL

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,11 @@ def get_httpx_client_kwargs() -> Dict[str, Any]:
# Auto-detect proxy from environment variables (httpx handles this automatically)
# HTTP_PROXY, HTTPS_PROXY, NO_PROXY are read by httpx by default

from ._config import UiPathConfig
from .constants import HEADER_LICENSING_CONTEXT

licensing_context = UiPathConfig.licensing_context
if licensing_context:
client_kwargs["headers"] = {HEADER_LICENSING_CONTEXT: licensing_context}

return client_kwargs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
HEADER_INTERNAL_TENANT_ID = "x-uipath-internal-tenantid"
HEADER_JOB_KEY = "x-uipath-jobkey"
HEADER_SW_LOCK_KEY = "x-uipath-sw-lockkey"
HEADER_LICENSING_CONTEXT = "x-uipath-licensing-context"

# Data sources (request types)
ORCHESTRATOR_STORAGE_BUCKET_DATA_SOURCE_REQUEST = (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
from ..common._config import UiPathApiConfig
from ..common._execution_context import UiPathExecutionContext
from ..common._folder_context import FolderContext, header_folder
from ..common._http_config import get_httpx_client_kwargs
from ..common._models import Endpoint, RequestSpec
from ..common._ssl_context import get_httpx_client_kwargs
from ..common.constants import (
ORCHESTRATOR_STORAGE_BUCKET_DATA_SOURCE,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
from ..common._config import UiPathApiConfig
from ..common._execution_context import UiPathExecutionContext
from ..common._folder_context import FolderContext, header_folder
from ..common._http_config import get_httpx_client_kwargs
from ..common._models import Endpoint, RequestSpec
from ..common._ssl_context import get_httpx_client_kwargs
from ..common.constants import TEMP_ATTACHMENTS_FOLDER


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
from ..common._config import UiPathApiConfig
from ..common._execution_context import UiPathExecutionContext
from ..common._folder_context import FolderContext, header_folder
from ..common._http_config import get_httpx_client_kwargs
from ..common._models import Endpoint, RequestSpec
from ..common._ssl_context import get_httpx_client_kwargs
from ..common.paging import PagedResult
from ..common.validation import validate_pagination_params
from .buckets import Bucket, BucketFile
Expand Down
2 changes: 1 addition & 1 deletion packages/uipath-platform/uv.lock

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

Loading