uipath 2.0.72__py3-none-any.whl → 2.0.74__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of uipath might be problematic. Click here for more details.
- uipath/_cli/_auth/_client_credentials.py +146 -0
- uipath/_cli/_auth/_portal_service.py +31 -4
- uipath/_cli/_auth/auth_config.json +2 -2
- uipath/_cli/_utils/_folders.py +18 -11
- uipath/_cli/_utils/_processes.py +27 -22
- uipath/_cli/cli_auth.py +111 -47
- uipath/_cli/cli_invoke.py +19 -18
- uipath/_cli/cli_pack.py +86 -3
- uipath/_cli/cli_publish.py +44 -38
- uipath/_services/_base_service.py +10 -10
- uipath/_services/attachments_service.py +6 -5
- uipath/_services/buckets_service.py +4 -8
- uipath/_utils/_ssl_context.py +54 -0
- {uipath-2.0.72.dist-info → uipath-2.0.74.dist-info}/METADATA +4 -1
- {uipath-2.0.72.dist-info → uipath-2.0.74.dist-info}/RECORD +18 -16
- {uipath-2.0.72.dist-info → uipath-2.0.74.dist-info}/WHEEL +0 -0
- {uipath-2.0.72.dist-info → uipath-2.0.74.dist-info}/entry_points.txt +0 -0
- {uipath-2.0.72.dist-info → uipath-2.0.74.dist-info}/licenses/LICENSE +0 -0
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
from typing import Optional
|
|
2
|
+
from urllib.parse import urlparse
|
|
3
|
+
|
|
4
|
+
import httpx
|
|
5
|
+
|
|
6
|
+
from ..._utils._ssl_context import get_httpx_client_kwargs
|
|
7
|
+
from .._utils._console import ConsoleLogger
|
|
8
|
+
from ._models import TokenData
|
|
9
|
+
from ._utils import parse_access_token, update_env_file
|
|
10
|
+
|
|
11
|
+
console = ConsoleLogger()
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class ClientCredentialsService:
|
|
15
|
+
"""Service for client credentials authentication flow."""
|
|
16
|
+
|
|
17
|
+
def __init__(self, domain: str):
|
|
18
|
+
self.domain = domain
|
|
19
|
+
|
|
20
|
+
def get_token_url(self) -> str:
|
|
21
|
+
"""Get the token URL for the specified domain."""
|
|
22
|
+
match self.domain:
|
|
23
|
+
case "alpha":
|
|
24
|
+
return "https://alpha.uipath.com/identity_/connect/token"
|
|
25
|
+
case "staging":
|
|
26
|
+
return "https://staging.uipath.com/identity_/connect/token"
|
|
27
|
+
case _: # cloud (default)
|
|
28
|
+
return "https://cloud.uipath.com/identity_/connect/token"
|
|
29
|
+
|
|
30
|
+
def _is_valid_domain_or_subdomain(self, hostname: str, domain: str) -> bool:
|
|
31
|
+
"""Check if hostname is either an exact match or a valid subdomain of the domain.
|
|
32
|
+
|
|
33
|
+
Args:
|
|
34
|
+
hostname: The hostname to check
|
|
35
|
+
domain: The domain to validate against
|
|
36
|
+
|
|
37
|
+
Returns:
|
|
38
|
+
True if hostname is valid domain or subdomain, False otherwise
|
|
39
|
+
"""
|
|
40
|
+
return hostname == domain or hostname.endswith(f".{domain}")
|
|
41
|
+
|
|
42
|
+
def extract_domain_from_base_url(self, base_url: str) -> str:
|
|
43
|
+
"""Extract domain from base URL.
|
|
44
|
+
|
|
45
|
+
Args:
|
|
46
|
+
base_url: The base URL to extract domain from
|
|
47
|
+
|
|
48
|
+
Returns:
|
|
49
|
+
The domain (alpha, staging, or cloud)
|
|
50
|
+
"""
|
|
51
|
+
try:
|
|
52
|
+
parsed = urlparse(base_url)
|
|
53
|
+
hostname = parsed.hostname
|
|
54
|
+
|
|
55
|
+
if hostname:
|
|
56
|
+
match hostname:
|
|
57
|
+
case h if self._is_valid_domain_or_subdomain(h, "alpha.uipath.com"):
|
|
58
|
+
return "alpha"
|
|
59
|
+
case h if self._is_valid_domain_or_subdomain(
|
|
60
|
+
h, "staging.uipath.com"
|
|
61
|
+
):
|
|
62
|
+
return "staging"
|
|
63
|
+
case h if self._is_valid_domain_or_subdomain(h, "cloud.uipath.com"):
|
|
64
|
+
return "cloud"
|
|
65
|
+
|
|
66
|
+
# Default to cloud if we can't determine
|
|
67
|
+
return "cloud"
|
|
68
|
+
except Exception:
|
|
69
|
+
# Default to cloud if parsing fails
|
|
70
|
+
return "cloud"
|
|
71
|
+
|
|
72
|
+
def authenticate(
|
|
73
|
+
self, client_id: str, client_secret: str, scope: str = "OR.Execution"
|
|
74
|
+
) -> Optional[TokenData]:
|
|
75
|
+
"""Authenticate using client credentials flow.
|
|
76
|
+
|
|
77
|
+
Args:
|
|
78
|
+
client_id: The client ID for authentication
|
|
79
|
+
client_secret: The client secret for authentication
|
|
80
|
+
scope: The scope for the token (default: OR.Execution)
|
|
81
|
+
|
|
82
|
+
Returns:
|
|
83
|
+
Token data if successful, None otherwise
|
|
84
|
+
"""
|
|
85
|
+
token_url = self.get_token_url()
|
|
86
|
+
|
|
87
|
+
data = {
|
|
88
|
+
"grant_type": "client_credentials",
|
|
89
|
+
"client_id": client_id,
|
|
90
|
+
"client_secret": client_secret,
|
|
91
|
+
"scope": scope,
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
try:
|
|
95
|
+
with httpx.Client(**get_httpx_client_kwargs()) as client:
|
|
96
|
+
response = client.post(token_url, data=data)
|
|
97
|
+
match response.status_code:
|
|
98
|
+
case 200:
|
|
99
|
+
token_data = response.json()
|
|
100
|
+
return {
|
|
101
|
+
"access_token": token_data["access_token"],
|
|
102
|
+
"token_type": token_data.get("token_type", "Bearer"),
|
|
103
|
+
"expires_in": token_data.get("expires_in", 3600),
|
|
104
|
+
"scope": token_data.get("scope", scope),
|
|
105
|
+
# Client credentials flow doesn't provide these, but we need them for compatibility
|
|
106
|
+
"refresh_token": "",
|
|
107
|
+
"id_token": "",
|
|
108
|
+
}
|
|
109
|
+
case 400:
|
|
110
|
+
console.error(
|
|
111
|
+
"Invalid client credentials or request parameters."
|
|
112
|
+
)
|
|
113
|
+
return None
|
|
114
|
+
case 401:
|
|
115
|
+
console.error("Unauthorized: Invalid client credentials.")
|
|
116
|
+
return None
|
|
117
|
+
case _:
|
|
118
|
+
console.error(
|
|
119
|
+
f"Authentication failed: {response.status_code} - {response.text}"
|
|
120
|
+
)
|
|
121
|
+
return None
|
|
122
|
+
|
|
123
|
+
except httpx.RequestError as e:
|
|
124
|
+
console.error(f"Network error during authentication: {e}")
|
|
125
|
+
return None
|
|
126
|
+
except Exception as e:
|
|
127
|
+
console.error(f"Unexpected error during authentication: {e}")
|
|
128
|
+
return None
|
|
129
|
+
|
|
130
|
+
def setup_environment(self, token_data: TokenData, base_url: str):
|
|
131
|
+
"""Setup environment variables for client credentials authentication.
|
|
132
|
+
|
|
133
|
+
Args:
|
|
134
|
+
token_data: The token data from authentication
|
|
135
|
+
base_url: The base URL for the UiPath instance
|
|
136
|
+
"""
|
|
137
|
+
parsed_access_token = parse_access_token(token_data["access_token"])
|
|
138
|
+
|
|
139
|
+
env_vars = {
|
|
140
|
+
"UIPATH_ACCESS_TOKEN": token_data["access_token"],
|
|
141
|
+
"UIPATH_URL": base_url,
|
|
142
|
+
"UIPATH_ORGANIZATION_ID": parsed_access_token.get("prt_id", ""),
|
|
143
|
+
"UIPATH_TENANT_ID": "",
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
update_env_file(env_vars)
|
|
@@ -5,6 +5,7 @@ from typing import Optional
|
|
|
5
5
|
import click
|
|
6
6
|
import httpx
|
|
7
7
|
|
|
8
|
+
from ..._utils._ssl_context import get_httpx_client_kwargs
|
|
8
9
|
from .._utils._console import ConsoleLogger
|
|
9
10
|
from ._models import TenantsAndOrganizationInfoResponse, TokenData
|
|
10
11
|
from ._oidc_utils import get_auth_config
|
|
@@ -16,7 +17,6 @@ from ._utils import (
|
|
|
16
17
|
)
|
|
17
18
|
|
|
18
19
|
console = ConsoleLogger()
|
|
19
|
-
client = httpx.Client(follow_redirects=True, timeout=30.0)
|
|
20
20
|
|
|
21
21
|
|
|
22
22
|
class PortalService:
|
|
@@ -27,6 +27,8 @@ class PortalService:
|
|
|
27
27
|
domain: Optional[str] = None
|
|
28
28
|
selected_tenant: Optional[str] = None
|
|
29
29
|
|
|
30
|
+
_client: Optional[httpx.Client] = None
|
|
31
|
+
|
|
30
32
|
_tenants_and_organizations: Optional[TenantsAndOrganizationInfoResponse] = None
|
|
31
33
|
|
|
32
34
|
def __init__(
|
|
@@ -39,13 +41,32 @@ class PortalService:
|
|
|
39
41
|
self.access_token = access_token
|
|
40
42
|
self.prt_id = prt_id
|
|
41
43
|
|
|
44
|
+
self._client = httpx.Client(**get_httpx_client_kwargs())
|
|
45
|
+
|
|
46
|
+
def close(self):
|
|
47
|
+
"""Explicitly close the HTTP client."""
|
|
48
|
+
if self._client:
|
|
49
|
+
self._client.close()
|
|
50
|
+
self._client = None
|
|
51
|
+
|
|
52
|
+
def __enter__(self):
|
|
53
|
+
"""Enter the runtime context related to this object."""
|
|
54
|
+
return self
|
|
55
|
+
|
|
56
|
+
def __exit__(self, exc_type, exc_value, traceback):
|
|
57
|
+
"""Exit the runtime context and close the HTTP client."""
|
|
58
|
+
self.close()
|
|
59
|
+
|
|
42
60
|
def update_token_data(self, token_data: TokenData):
|
|
43
61
|
self.access_token = token_data["access_token"]
|
|
44
62
|
self.prt_id = get_parsed_token_data(token_data).get("prt_id")
|
|
45
63
|
|
|
46
64
|
def get_tenants_and_organizations(self) -> TenantsAndOrganizationInfoResponse:
|
|
65
|
+
if self._client is None:
|
|
66
|
+
raise RuntimeError("HTTP client is not initialized")
|
|
67
|
+
|
|
47
68
|
url = f"https://{self.domain}.uipath.com/{self.prt_id}/portal_/api/filtering/leftnav/tenantsAndOrganizationInfo"
|
|
48
|
-
response =
|
|
69
|
+
response = self._client.get(
|
|
49
70
|
url, headers={"Authorization": f"Bearer {self.access_token}"}
|
|
50
71
|
)
|
|
51
72
|
if response.status_code < 400:
|
|
@@ -72,6 +93,9 @@ class PortalService:
|
|
|
72
93
|
return f"https://{self.domain}.uipath.com/{account_name}/{self.selected_tenant}/orchestrator_"
|
|
73
94
|
|
|
74
95
|
def post_refresh_token_request(self, refresh_token: str) -> TokenData:
|
|
96
|
+
if self._client is None:
|
|
97
|
+
raise RuntimeError("HTTP client is not initialized")
|
|
98
|
+
|
|
75
99
|
url = f"https://{self.domain}.uipath.com/identity_/connect/token"
|
|
76
100
|
client_id = get_auth_config().get("client_id")
|
|
77
101
|
|
|
@@ -83,7 +107,7 @@ class PortalService:
|
|
|
83
107
|
|
|
84
108
|
headers = {"Content-Type": "application/x-www-form-urlencoded"}
|
|
85
109
|
|
|
86
|
-
response =
|
|
110
|
+
response = self._client.post(url, data=data, headers=headers)
|
|
87
111
|
if response.status_code < 400:
|
|
88
112
|
return response.json()
|
|
89
113
|
elif response.status_code == 401:
|
|
@@ -137,6 +161,9 @@ class PortalService:
|
|
|
137
161
|
update_env_file(updated_env_contents)
|
|
138
162
|
|
|
139
163
|
def post_auth(self, base_url: str) -> None:
|
|
164
|
+
if self._client is None:
|
|
165
|
+
raise RuntimeError("HTTP client is not initialized")
|
|
166
|
+
|
|
140
167
|
or_base_url = (
|
|
141
168
|
f"{base_url}/orchestrator_"
|
|
142
169
|
if base_url
|
|
@@ -148,7 +175,7 @@ class PortalService:
|
|
|
148
175
|
|
|
149
176
|
try:
|
|
150
177
|
[try_enable_first_run_response, acquire_license_response] = [
|
|
151
|
-
|
|
178
|
+
self._client.post(
|
|
152
179
|
url,
|
|
153
180
|
headers={"Authorization": f"Bearer {self.access_token}"},
|
|
154
181
|
)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"client_id": "36dea5b8-e8bb-423d-8e7b-c808df8f1c00",
|
|
3
3
|
"redirect_uri": "http://localhost:__PY_REPLACE_PORT__/oidc/login",
|
|
4
|
-
"scope": "offline_access OrchestratorApiUserAccess ConnectionService DataService DocumentUnderstanding EnterpriseContextService Directory JamJamApi LLMGateway LLMOps OMS RCS.FolderAuthorization",
|
|
4
|
+
"scope": "offline_access OrchestratorApiUserAccess IdentityServerApi ConnectionService DataService DocumentUnderstanding EnterpriseContextService Directory JamJamApi LLMGateway LLMOps OMS RCS.FolderAuthorization",
|
|
5
5
|
"port": 8104
|
|
6
|
-
}
|
|
6
|
+
}
|
uipath/_cli/_utils/_folders.py
CHANGED
|
@@ -2,27 +2,34 @@ from typing import Optional, Tuple
|
|
|
2
2
|
|
|
3
3
|
import httpx
|
|
4
4
|
|
|
5
|
+
from ..._utils._ssl_context import get_httpx_client_kwargs
|
|
5
6
|
from ._console import ConsoleLogger
|
|
6
7
|
|
|
7
8
|
console = ConsoleLogger()
|
|
8
|
-
client = httpx.Client(follow_redirects=True, timeout=30.0)
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
def get_personal_workspace_info(
|
|
12
12
|
base_url: str, token: str
|
|
13
13
|
) -> Tuple[Optional[str], Optional[str]]:
|
|
14
14
|
user_url = f"{base_url}/orchestrator_/odata/Users/UiPath.Server.Configuration.OData.GetCurrentUserExtended?$expand=PersonalWorkspace"
|
|
15
|
-
user_response = client.get(user_url, headers={"Authorization": f"Bearer {token}"})
|
|
16
15
|
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
with httpx.Client(**get_httpx_client_kwargs()) as client:
|
|
17
|
+
user_response = client.get(
|
|
18
|
+
user_url, headers={"Authorization": f"Bearer {token}"}
|
|
19
|
+
)
|
|
19
20
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
if user_response.status_code != 200:
|
|
22
|
+
console.error(
|
|
23
|
+
"Error: Failed to fetch user info. Please try reauthenticating."
|
|
24
|
+
)
|
|
25
|
+
return None, None
|
|
23
26
|
|
|
24
|
-
|
|
25
|
-
|
|
27
|
+
user_data = user_response.json()
|
|
28
|
+
feed_id = user_data.get("PersonalWorskpaceFeedId")
|
|
29
|
+
personal_workspace = user_data.get("PersonalWorkspace")
|
|
26
30
|
|
|
27
|
-
|
|
28
|
-
|
|
31
|
+
if not personal_workspace or not feed_id or "Id" not in personal_workspace:
|
|
32
|
+
return None, None
|
|
33
|
+
|
|
34
|
+
folder_id = personal_workspace.get("Id")
|
|
35
|
+
return feed_id, folder_id
|
uipath/_cli/_utils/_processes.py
CHANGED
|
@@ -4,10 +4,10 @@ from typing import Any
|
|
|
4
4
|
|
|
5
5
|
import httpx
|
|
6
6
|
|
|
7
|
+
from ..._utils._ssl_context import get_httpx_client_kwargs
|
|
7
8
|
from ._console import ConsoleLogger
|
|
8
9
|
|
|
9
10
|
console = ConsoleLogger()
|
|
10
|
-
client = httpx.Client(follow_redirects=True, timeout=30.0)
|
|
11
11
|
odata_top_filter = 25
|
|
12
12
|
|
|
13
13
|
|
|
@@ -24,26 +24,31 @@ def get_release_info(
|
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
release_url = f"{base_url}/orchestrator_/odata/Releases/UiPath.Server.Configuration.OData.ListReleases?$select=Id,Key,ProcessVersion&$top={odata_top_filter}&$filter=ProcessKey%20eq%20%27{urllib.parse.quote(package_name)}%27"
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
27
|
+
|
|
28
|
+
with httpx.Client(**get_httpx_client_kwargs()) as client:
|
|
29
|
+
response = client.get(release_url, headers=headers)
|
|
30
|
+
|
|
31
|
+
if response.status_code == 200:
|
|
32
|
+
try:
|
|
33
|
+
data = json.loads(response.text)
|
|
34
|
+
process = next(
|
|
35
|
+
process
|
|
36
|
+
for process in data["value"]
|
|
37
|
+
if process["ProcessVersion"] == package_version
|
|
38
|
+
)
|
|
39
|
+
release_id = process["Id"]
|
|
40
|
+
release_key = process["Key"]
|
|
41
|
+
return release_id, release_key
|
|
42
|
+
except KeyError:
|
|
43
|
+
console.warning("Warning: Failed to deserialize release data")
|
|
44
|
+
return None, None
|
|
45
|
+
except StopIteration:
|
|
46
|
+
console.error(
|
|
47
|
+
f"Error: No process with name '{package_name}' found in your workspace. Please publish the process first."
|
|
48
|
+
)
|
|
49
|
+
return None, None
|
|
50
|
+
else:
|
|
51
|
+
console.warning(
|
|
52
|
+
f"Warning: Failed to fetch release info {response.status_code}"
|
|
45
53
|
)
|
|
46
54
|
return None, None
|
|
47
|
-
else:
|
|
48
|
-
console.warning(f"Warning: Failed to fetch release info {response.status_code}")
|
|
49
|
-
return None, None
|
uipath/_cli/cli_auth.py
CHANGED
|
@@ -9,6 +9,7 @@ from dotenv import load_dotenv
|
|
|
9
9
|
|
|
10
10
|
from ..telemetry import track
|
|
11
11
|
from ._auth._auth_server import HTTPServer
|
|
12
|
+
from ._auth._client_credentials import ClientCredentialsService
|
|
12
13
|
from ._auth._oidc_utils import get_auth_config, get_auth_url
|
|
13
14
|
from ._auth._portal_service import PortalService, select_tenant
|
|
14
15
|
from ._auth._utils import update_auth_file, update_env_file
|
|
@@ -64,60 +65,123 @@ def set_port():
|
|
|
64
65
|
required=False,
|
|
65
66
|
help="Force new token",
|
|
66
67
|
)
|
|
68
|
+
@click.option(
|
|
69
|
+
"--client-id",
|
|
70
|
+
required=False,
|
|
71
|
+
help="Client ID for client credentials authentication (unattended mode)",
|
|
72
|
+
)
|
|
73
|
+
@click.option(
|
|
74
|
+
"--client-secret",
|
|
75
|
+
required=False,
|
|
76
|
+
help="Client secret for client credentials authentication (unattended mode)",
|
|
77
|
+
)
|
|
78
|
+
@click.option(
|
|
79
|
+
"--base-url",
|
|
80
|
+
required=False,
|
|
81
|
+
help="Base URL for the UiPath tenant instance (required for client credentials)",
|
|
82
|
+
)
|
|
67
83
|
@track
|
|
68
|
-
def auth(
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
webbrowser.open(auth_url, 1)
|
|
93
|
-
auth_config = get_auth_config()
|
|
84
|
+
def auth(
|
|
85
|
+
domain,
|
|
86
|
+
force: None | bool = False,
|
|
87
|
+
client_id: str = None,
|
|
88
|
+
client_secret: str = None,
|
|
89
|
+
base_url: str = None,
|
|
90
|
+
):
|
|
91
|
+
"""Authenticate with UiPath Cloud Platform.
|
|
92
|
+
|
|
93
|
+
Interactive mode (default): Opens browser for OAuth authentication.
|
|
94
|
+
Unattended mode: Use --client-id, --client-secret and --base-url for client credentials flow.
|
|
95
|
+
|
|
96
|
+
Network options:
|
|
97
|
+
- Set HTTP_PROXY/HTTPS_PROXY/NO_PROXY environment variables for proxy configuration
|
|
98
|
+
- Set REQUESTS_CA_BUNDLE to specify a custom CA bundle for SSL verification
|
|
99
|
+
- Set UIPATH_DISABLE_SSL_VERIFY to disable SSL verification (not recommended)
|
|
100
|
+
"""
|
|
101
|
+
# Check if client credentials are provided for unattended authentication
|
|
102
|
+
if client_id and client_secret:
|
|
103
|
+
if not base_url:
|
|
104
|
+
console.error(
|
|
105
|
+
"--base-url is required when using client credentials authentication."
|
|
106
|
+
)
|
|
107
|
+
return
|
|
94
108
|
|
|
95
|
-
console.
|
|
96
|
-
|
|
97
|
-
auth_url,
|
|
98
|
-
)
|
|
109
|
+
with console.spinner("Authenticating with client credentials ..."):
|
|
110
|
+
credentials_service = ClientCredentialsService(domain)
|
|
99
111
|
|
|
100
|
-
|
|
101
|
-
|
|
112
|
+
# If base_url is provided, extract domain from it to override the CLI domain parameter
|
|
113
|
+
if base_url:
|
|
114
|
+
extracted_domain = credentials_service.extract_domain_from_base_url(
|
|
115
|
+
base_url
|
|
116
|
+
)
|
|
117
|
+
credentials_service.domain = extracted_domain
|
|
102
118
|
|
|
103
|
-
|
|
104
|
-
portal_service.update_token_data(token_data)
|
|
105
|
-
update_auth_file(token_data)
|
|
106
|
-
access_token = token_data["access_token"]
|
|
107
|
-
update_env_file({"UIPATH_ACCESS_TOKEN": access_token})
|
|
119
|
+
token_data = credentials_service.authenticate(client_id, client_secret)
|
|
108
120
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
try:
|
|
112
|
-
portal_service.post_auth(base_url)
|
|
121
|
+
if token_data:
|
|
122
|
+
credentials_service.setup_environment(token_data, base_url)
|
|
113
123
|
console.success(
|
|
114
|
-
"
|
|
124
|
+
"Client credentials authentication successful.",
|
|
115
125
|
)
|
|
116
|
-
|
|
126
|
+
else:
|
|
117
127
|
console.error(
|
|
118
|
-
"
|
|
128
|
+
"Client credentials authentication failed. Please check your credentials.",
|
|
119
129
|
)
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
130
|
+
return
|
|
131
|
+
|
|
132
|
+
# Interactive authentication flow (existing logic)
|
|
133
|
+
with console.spinner("Authenticating with UiPath ..."):
|
|
134
|
+
with PortalService(domain) as portal_service:
|
|
135
|
+
if not force:
|
|
136
|
+
if (
|
|
137
|
+
os.getenv("UIPATH_URL")
|
|
138
|
+
and os.getenv("UIPATH_TENANT_ID")
|
|
139
|
+
and os.getenv("UIPATH_ORGANIZATION_ID")
|
|
140
|
+
):
|
|
141
|
+
try:
|
|
142
|
+
portal_service.ensure_valid_token()
|
|
143
|
+
console.success(
|
|
144
|
+
"Authentication successful.",
|
|
145
|
+
)
|
|
146
|
+
return
|
|
147
|
+
except Exception:
|
|
148
|
+
console.info(
|
|
149
|
+
"Authentication token is invalid. Please reauthenticate.",
|
|
150
|
+
)
|
|
151
|
+
|
|
152
|
+
auth_url, code_verifier, state = get_auth_url(domain)
|
|
153
|
+
|
|
154
|
+
webbrowser.open(auth_url, 1)
|
|
155
|
+
auth_config = get_auth_config()
|
|
156
|
+
|
|
157
|
+
console.link(
|
|
158
|
+
"If a browser window did not open, please open the following URL in your browser:",
|
|
159
|
+
auth_url,
|
|
123
160
|
)
|
|
161
|
+
|
|
162
|
+
server = HTTPServer(port=auth_config["port"])
|
|
163
|
+
token_data = server.start(state, code_verifier, domain)
|
|
164
|
+
|
|
165
|
+
if token_data:
|
|
166
|
+
portal_service.update_token_data(token_data)
|
|
167
|
+
update_auth_file(token_data)
|
|
168
|
+
access_token = token_data["access_token"]
|
|
169
|
+
update_env_file({"UIPATH_ACCESS_TOKEN": access_token})
|
|
170
|
+
|
|
171
|
+
tenants_and_organizations = (
|
|
172
|
+
portal_service.get_tenants_and_organizations()
|
|
173
|
+
)
|
|
174
|
+
base_url = select_tenant(domain, tenants_and_organizations)
|
|
175
|
+
try:
|
|
176
|
+
portal_service.post_auth(base_url)
|
|
177
|
+
console.success(
|
|
178
|
+
"Authentication successful.",
|
|
179
|
+
)
|
|
180
|
+
except Exception:
|
|
181
|
+
console.error(
|
|
182
|
+
"Could not prepare the environment. Please try again.",
|
|
183
|
+
)
|
|
184
|
+
else:
|
|
185
|
+
console.error(
|
|
186
|
+
"Authentication failed. Please try again.",
|
|
187
|
+
)
|
uipath/_cli/cli_invoke.py
CHANGED
|
@@ -14,6 +14,7 @@ try:
|
|
|
14
14
|
except ImportError:
|
|
15
15
|
import tomli as tomllib
|
|
16
16
|
|
|
17
|
+
from .._utils._ssl_context import get_httpx_client_kwargs
|
|
17
18
|
from ..telemetry import track
|
|
18
19
|
from ._utils._common import get_env_vars
|
|
19
20
|
from ._utils._folders import get_personal_workspace_info
|
|
@@ -22,7 +23,6 @@ from ._utils._processes import get_release_info
|
|
|
22
23
|
logger = logging.getLogger(__name__)
|
|
23
24
|
load_dotenv(override=True)
|
|
24
25
|
console = ConsoleLogger()
|
|
25
|
-
client = httpx.Client(follow_redirects=True, timeout=30.0)
|
|
26
26
|
|
|
27
27
|
|
|
28
28
|
def _read_project_details() -> [str, str]:
|
|
@@ -92,23 +92,24 @@ def invoke(
|
|
|
92
92
|
"x-uipath-organizationunitid": str(personal_workspace_folder_id),
|
|
93
93
|
}
|
|
94
94
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
95
|
+
with httpx.Client(**get_httpx_client_kwargs()) as client:
|
|
96
|
+
response = client.post(url, json=payload, headers=headers)
|
|
97
|
+
|
|
98
|
+
if response.status_code == 201:
|
|
99
|
+
job_key = None
|
|
100
|
+
try:
|
|
101
|
+
job_key = response.json()["value"][0]["Key"]
|
|
102
|
+
except KeyError:
|
|
103
|
+
console.error("Error: Failed to get job key from response")
|
|
104
|
+
if job_key:
|
|
105
|
+
with console.spinner("Starting job ..."):
|
|
106
|
+
job_url = f"{base_url}/orchestrator_/jobs(sidepanel:sidepanel/jobs/{job_key}/details)?fid={personal_workspace_folder_id}"
|
|
107
|
+
console.magic("Job started successfully!")
|
|
108
|
+
console.link("Monitor your job here: ", job_url)
|
|
109
|
+
else:
|
|
110
|
+
console.error(
|
|
111
|
+
f"Error: Failed to start job. Status code: {response.status_code} {response.text}"
|
|
112
|
+
)
|
|
112
113
|
|
|
113
114
|
|
|
114
115
|
if __name__ == "__main__":
|
uipath/_cli/cli_pack.py
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# type: ignore
|
|
2
2
|
import json
|
|
3
3
|
import os
|
|
4
|
+
import subprocess
|
|
4
5
|
import uuid
|
|
5
6
|
import zipfile
|
|
6
7
|
from string import Template
|
|
@@ -52,6 +53,66 @@ def check_config(directory):
|
|
|
52
53
|
}
|
|
53
54
|
|
|
54
55
|
|
|
56
|
+
def is_uv_available():
|
|
57
|
+
"""Check if uv command is available in the system."""
|
|
58
|
+
try:
|
|
59
|
+
subprocess.run(["uv", "--version"], capture_output=True, check=True, timeout=20)
|
|
60
|
+
return True
|
|
61
|
+
except (subprocess.CalledProcessError, FileNotFoundError):
|
|
62
|
+
return False
|
|
63
|
+
except Exception as e:
|
|
64
|
+
console.warning(
|
|
65
|
+
f"An unexpected error occurred while checking uv availability: {str(e)}"
|
|
66
|
+
)
|
|
67
|
+
return False
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
def is_uv_project(directory):
|
|
71
|
+
"""Check if this is a uv project by looking for the uv.lock file."""
|
|
72
|
+
uv_lock_path = os.path.join(directory, "uv.lock")
|
|
73
|
+
|
|
74
|
+
# If uv.lock exists, it's definitely a uv project
|
|
75
|
+
if os.path.exists(uv_lock_path):
|
|
76
|
+
return True
|
|
77
|
+
|
|
78
|
+
return False
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
def run_uv_lock(directory):
|
|
82
|
+
"""Run uv lock to update the lock file."""
|
|
83
|
+
try:
|
|
84
|
+
subprocess.run(
|
|
85
|
+
["uv", "lock"],
|
|
86
|
+
cwd=directory,
|
|
87
|
+
capture_output=True,
|
|
88
|
+
text=True,
|
|
89
|
+
check=True,
|
|
90
|
+
timeout=60,
|
|
91
|
+
)
|
|
92
|
+
return True
|
|
93
|
+
except subprocess.CalledProcessError as e:
|
|
94
|
+
console.warning(f"uv lock failed: {e.stderr}")
|
|
95
|
+
return False
|
|
96
|
+
except FileNotFoundError:
|
|
97
|
+
console.warning("uv command not found. Skipping lock file update.")
|
|
98
|
+
return False
|
|
99
|
+
except Exception as e:
|
|
100
|
+
console.warning(f"An unexpected error occurred while running uv lock: {str(e)}")
|
|
101
|
+
return False
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
def handle_uv_operations(directory):
|
|
105
|
+
"""Handle uv operations if uv is detected and available."""
|
|
106
|
+
if not is_uv_available():
|
|
107
|
+
return
|
|
108
|
+
|
|
109
|
+
if not is_uv_project(directory):
|
|
110
|
+
return
|
|
111
|
+
|
|
112
|
+
# Always run uv lock to ensure lock file is up to date
|
|
113
|
+
run_uv_lock(directory)
|
|
114
|
+
|
|
115
|
+
|
|
55
116
|
def generate_operate_file(entryPoints):
|
|
56
117
|
project_id = str(uuid.uuid4())
|
|
57
118
|
|
|
@@ -210,7 +271,15 @@ def is_venv_dir(d):
|
|
|
210
271
|
)
|
|
211
272
|
|
|
212
273
|
|
|
213
|
-
def pack_fn(
|
|
274
|
+
def pack_fn(
|
|
275
|
+
projectName,
|
|
276
|
+
description,
|
|
277
|
+
entryPoints,
|
|
278
|
+
version,
|
|
279
|
+
authors,
|
|
280
|
+
directory,
|
|
281
|
+
include_uv_lock=True,
|
|
282
|
+
):
|
|
214
283
|
operate_file = generate_operate_file(entryPoints)
|
|
215
284
|
entrypoints_file = generate_entrypoints_file(entryPoints)
|
|
216
285
|
|
|
@@ -304,7 +373,11 @@ def pack_fn(projectName, description, entryPoints, version, authors, directory):
|
|
|
304
373
|
with open(file_path, "r", encoding="latin-1") as f:
|
|
305
374
|
z.writestr(f"content/{rel_path}", f.read())
|
|
306
375
|
|
|
307
|
-
|
|
376
|
+
# Handle optional files, conditionally including uv.lock
|
|
377
|
+
optional_files = ["pyproject.toml", "README.md"]
|
|
378
|
+
if include_uv_lock:
|
|
379
|
+
optional_files.append("uv.lock")
|
|
380
|
+
|
|
308
381
|
for file in optional_files:
|
|
309
382
|
file_path = os.path.join(directory, file)
|
|
310
383
|
if os.path.exists(file_path):
|
|
@@ -367,8 +440,13 @@ def display_project_info(config):
|
|
|
367
440
|
|
|
368
441
|
@click.command()
|
|
369
442
|
@click.argument("root", type=str, default="./")
|
|
443
|
+
@click.option(
|
|
444
|
+
"--nolock",
|
|
445
|
+
is_flag=True,
|
|
446
|
+
help="Skip running uv lock and exclude uv.lock from the package",
|
|
447
|
+
)
|
|
370
448
|
@track
|
|
371
|
-
def pack(root):
|
|
449
|
+
def pack(root, nolock):
|
|
372
450
|
"""Pack the project."""
|
|
373
451
|
version = get_project_version(root)
|
|
374
452
|
|
|
@@ -403,6 +481,10 @@ def pack(root):
|
|
|
403
481
|
|
|
404
482
|
with console.spinner("Packaging project ..."):
|
|
405
483
|
try:
|
|
484
|
+
# Handle uv operations before packaging, unless nolock is specified
|
|
485
|
+
if not nolock:
|
|
486
|
+
handle_uv_operations(root)
|
|
487
|
+
|
|
406
488
|
pack_fn(
|
|
407
489
|
config["project_name"],
|
|
408
490
|
config["description"],
|
|
@@ -410,6 +492,7 @@ def pack(root):
|
|
|
410
492
|
version or config["version"],
|
|
411
493
|
config["authors"],
|
|
412
494
|
root,
|
|
495
|
+
include_uv_lock=not nolock,
|
|
413
496
|
)
|
|
414
497
|
display_project_info(config)
|
|
415
498
|
console.success("Project successfully packaged.")
|
uipath/_cli/cli_publish.py
CHANGED
|
@@ -6,6 +6,7 @@ import click
|
|
|
6
6
|
import httpx
|
|
7
7
|
from dotenv import load_dotenv
|
|
8
8
|
|
|
9
|
+
from .._utils._ssl_context import get_httpx_client_kwargs
|
|
9
10
|
from ..telemetry import track
|
|
10
11
|
from ._utils._common import get_env_vars
|
|
11
12
|
from ._utils._console import ConsoleLogger
|
|
@@ -13,7 +14,6 @@ from ._utils._folders import get_personal_workspace_info
|
|
|
13
14
|
from ._utils._processes import get_release_info
|
|
14
15
|
|
|
15
16
|
console = ConsoleLogger()
|
|
16
|
-
client = httpx.Client(follow_redirects=True, timeout=30.0)
|
|
17
17
|
|
|
18
18
|
|
|
19
19
|
def get_most_recent_package():
|
|
@@ -35,7 +35,10 @@ def get_available_feeds(
|
|
|
35
35
|
base_url: str, headers: dict[str, str]
|
|
36
36
|
) -> list[tuple[str, str]]:
|
|
37
37
|
url = f"{base_url}/orchestrator_/api/PackageFeeds/GetFeeds"
|
|
38
|
-
|
|
38
|
+
|
|
39
|
+
with httpx.Client(**get_httpx_client_kwargs()) as client:
|
|
40
|
+
response = client.get(url, headers=headers)
|
|
41
|
+
|
|
39
42
|
if response.status_code != 200:
|
|
40
43
|
console.error(
|
|
41
44
|
f"Failed to fetch available feeds. Please check your connection. Status code: {response.status_code} {response.text}"
|
|
@@ -123,40 +126,43 @@ def publish(feed):
|
|
|
123
126
|
else:
|
|
124
127
|
url = url + "?feedId=" + feed
|
|
125
128
|
|
|
126
|
-
with
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
129
|
+
with httpx.Client(**get_httpx_client_kwargs()) as client:
|
|
130
|
+
with open(package_to_publish_path, "rb") as f:
|
|
131
|
+
files = {
|
|
132
|
+
"file": (package_to_publish_path, f, "application/octet-stream")
|
|
133
|
+
}
|
|
134
|
+
response = client.post(url, headers=headers, files=files)
|
|
135
|
+
|
|
136
|
+
if response.status_code == 200:
|
|
137
|
+
console.success("Package published successfully!")
|
|
138
|
+
|
|
139
|
+
if is_personal_workspace:
|
|
140
|
+
package_name = None
|
|
141
|
+
package_version = None
|
|
142
|
+
try:
|
|
143
|
+
data = json.loads(response.text)["value"][0]["Body"]
|
|
144
|
+
package_name = json.loads(data)["Id"]
|
|
145
|
+
package_version = json.loads(data)["Version"]
|
|
146
|
+
except json.decoder.JSONDecodeError:
|
|
147
|
+
console.warning("Failed to deserialize package name")
|
|
148
|
+
if package_name is not None:
|
|
149
|
+
with console.spinner("Getting process information ..."):
|
|
150
|
+
release_id, _ = get_release_info(
|
|
151
|
+
base_url,
|
|
152
|
+
token,
|
|
153
|
+
package_name,
|
|
154
|
+
package_version,
|
|
155
|
+
personal_workspace_feed_id,
|
|
156
|
+
)
|
|
157
|
+
if release_id:
|
|
158
|
+
process_url = f"{base_url}/orchestrator_/processes/{release_id}/edit?fid={personal_workspace_folder_id}"
|
|
159
|
+
console.link("Process configuration link:", process_url)
|
|
160
|
+
console.hint(
|
|
161
|
+
"Use the link above to configure any environment variables"
|
|
162
|
+
)
|
|
163
|
+
else:
|
|
164
|
+
console.warning("Failed to compose process url")
|
|
157
165
|
else:
|
|
158
|
-
console.
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
f"Failed to publish package. Status code: {response.status_code} {response.text}"
|
|
162
|
-
)
|
|
166
|
+
console.error(
|
|
167
|
+
f"Failed to publish package. Status code: {response.status_code} {response.text}"
|
|
168
|
+
)
|
|
@@ -23,6 +23,7 @@ from uipath._utils._read_overwrites import OverwritesManager
|
|
|
23
23
|
from .._config import Config
|
|
24
24
|
from .._execution_context import ExecutionContext
|
|
25
25
|
from .._utils import UiPathUrl, user_agent_value
|
|
26
|
+
from .._utils._ssl_context import get_httpx_client_kwargs
|
|
26
27
|
from .._utils.constants import HEADER_USER_AGENT
|
|
27
28
|
|
|
28
29
|
|
|
@@ -42,17 +43,16 @@ class BaseService:
|
|
|
42
43
|
|
|
43
44
|
self._url = UiPathUrl(self._config.base_url)
|
|
44
45
|
|
|
45
|
-
|
|
46
|
-
base_url=self._url.base_url,
|
|
47
|
-
headers=Headers(self.default_headers),
|
|
48
|
-
timeout=30.0,
|
|
49
|
-
)
|
|
46
|
+
default_client_kwargs = get_httpx_client_kwargs()
|
|
50
47
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
48
|
+
client_kwargs = {
|
|
49
|
+
**default_client_kwargs, # SSL, proxy, timeout, redirects
|
|
50
|
+
"base_url": self._url.base_url,
|
|
51
|
+
"headers": Headers(self.default_headers),
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
self._client = Client(**client_kwargs)
|
|
55
|
+
self._client_async = AsyncClient(**client_kwargs)
|
|
56
56
|
|
|
57
57
|
self._overwrites_manager = OverwritesManager()
|
|
58
58
|
self._logger.debug(f"HEADERS: {self.default_headers}")
|
|
@@ -11,6 +11,7 @@ from .._config import Config
|
|
|
11
11
|
from .._execution_context import ExecutionContext
|
|
12
12
|
from .._folder_context import FolderContext
|
|
13
13
|
from .._utils import Endpoint, RequestSpec, header_folder
|
|
14
|
+
from .._utils._ssl_context import get_httpx_client_kwargs
|
|
14
15
|
from .._utils.constants import TEMP_ATTACHMENTS_FOLDER
|
|
15
16
|
from ..tracing._traced import traced
|
|
16
17
|
from ._base_service import BaseService
|
|
@@ -121,7 +122,7 @@ class AttachmentsService(FolderContext, BaseService):
|
|
|
121
122
|
for chunk in response.iter_bytes(chunk_size=8192):
|
|
122
123
|
file.write(chunk)
|
|
123
124
|
else:
|
|
124
|
-
with httpx.Client() as client:
|
|
125
|
+
with httpx.Client(**get_httpx_client_kwargs()) as client:
|
|
125
126
|
with client.stream(
|
|
126
127
|
"GET", download_uri, headers=headers
|
|
127
128
|
) as response:
|
|
@@ -390,7 +391,7 @@ class AttachmentsService(FolderContext, BaseService):
|
|
|
390
391
|
"PUT", upload_uri, headers=headers, content=file_content
|
|
391
392
|
)
|
|
392
393
|
else:
|
|
393
|
-
with httpx.Client() as client:
|
|
394
|
+
with httpx.Client(**get_httpx_client_kwargs()) as client:
|
|
394
395
|
client.put(upload_uri, headers=headers, content=file_content)
|
|
395
396
|
else:
|
|
396
397
|
# Upload from memory
|
|
@@ -401,7 +402,7 @@ class AttachmentsService(FolderContext, BaseService):
|
|
|
401
402
|
if result["BlobFileAccess"]["RequiresAuth"]:
|
|
402
403
|
self.request("PUT", upload_uri, headers=headers, content=content)
|
|
403
404
|
else:
|
|
404
|
-
with httpx.Client() as client:
|
|
405
|
+
with httpx.Client(**get_httpx_client_kwargs()) as client:
|
|
405
406
|
client.put(upload_uri, headers=headers, content=content)
|
|
406
407
|
|
|
407
408
|
return attachment_key
|
|
@@ -526,7 +527,7 @@ class AttachmentsService(FolderContext, BaseService):
|
|
|
526
527
|
"PUT", upload_uri, headers=headers, content=file_content
|
|
527
528
|
)
|
|
528
529
|
else:
|
|
529
|
-
with httpx.Client() as client:
|
|
530
|
+
with httpx.Client(**get_httpx_client_kwargs()) as client:
|
|
530
531
|
client.put(upload_uri, headers=headers, content=file_content)
|
|
531
532
|
else:
|
|
532
533
|
# Upload from memory
|
|
@@ -539,7 +540,7 @@ class AttachmentsService(FolderContext, BaseService):
|
|
|
539
540
|
"PUT", upload_uri, headers=headers, content=content
|
|
540
541
|
)
|
|
541
542
|
else:
|
|
542
|
-
with httpx.Client() as client:
|
|
543
|
+
with httpx.Client(**get_httpx_client_kwargs()) as client:
|
|
543
544
|
client.put(upload_uri, headers=headers, content=content)
|
|
544
545
|
|
|
545
546
|
return attachment_key
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import mimetypes
|
|
2
|
-
from typing import
|
|
2
|
+
from typing import Dict, Optional, Union
|
|
3
3
|
|
|
4
4
|
import httpx
|
|
5
5
|
|
|
@@ -7,16 +7,12 @@ from .._config import Config
|
|
|
7
7
|
from .._execution_context import ExecutionContext
|
|
8
8
|
from .._folder_context import FolderContext
|
|
9
9
|
from .._utils import Endpoint, RequestSpec, header_folder, infer_bindings
|
|
10
|
+
from .._utils._ssl_context import get_httpx_client_kwargs
|
|
10
11
|
from ..models import Bucket
|
|
11
12
|
from ..tracing._traced import traced
|
|
12
13
|
from ._base_service import BaseService
|
|
13
14
|
|
|
14
15
|
|
|
15
|
-
def _upload_from_memory_input_processor(inputs: Dict[str, Any]) -> Dict[str, Any]:
|
|
16
|
-
inputs["content"] = "<Redacted>"
|
|
17
|
-
return inputs
|
|
18
|
-
|
|
19
|
-
|
|
20
16
|
class BucketsService(FolderContext, BaseService):
|
|
21
17
|
"""Service for managing UiPath storage buckets.
|
|
22
18
|
|
|
@@ -26,8 +22,8 @@ class BucketsService(FolderContext, BaseService):
|
|
|
26
22
|
|
|
27
23
|
def __init__(self, config: Config, execution_context: ExecutionContext) -> None:
|
|
28
24
|
super().__init__(config=config, execution_context=execution_context)
|
|
29
|
-
self.custom_client = httpx.Client()
|
|
30
|
-
self.custom_client_async = httpx.AsyncClient()
|
|
25
|
+
self.custom_client = httpx.Client(**get_httpx_client_kwargs())
|
|
26
|
+
self.custom_client_async = httpx.AsyncClient(**get_httpx_client_kwargs())
|
|
31
27
|
|
|
32
28
|
@traced(name="buckets_download", run_type="uipath")
|
|
33
29
|
@infer_bindings(resource_type="bucket")
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import ssl
|
|
3
|
+
from typing import Any, Dict
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
def expand_path(path):
|
|
7
|
+
"""Expand environment variables and user home directory in path."""
|
|
8
|
+
if not path:
|
|
9
|
+
return path
|
|
10
|
+
# Expand environment variables like $HOME
|
|
11
|
+
path = os.path.expandvars(path)
|
|
12
|
+
# Expand user home directory ~
|
|
13
|
+
path = os.path.expanduser(path)
|
|
14
|
+
return path
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def create_ssl_context():
|
|
18
|
+
# Try truststore first (system certificates)
|
|
19
|
+
try:
|
|
20
|
+
import truststore
|
|
21
|
+
|
|
22
|
+
return truststore.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
|
|
23
|
+
except ImportError:
|
|
24
|
+
# Fallback to manual certificate configuration
|
|
25
|
+
import certifi
|
|
26
|
+
|
|
27
|
+
ssl_cert_file = expand_path(os.environ.get("SSL_CERT_FILE"))
|
|
28
|
+
requests_ca_bundle = expand_path(os.environ.get("REQUESTS_CA_BUNDLE"))
|
|
29
|
+
ssl_cert_dir = expand_path(os.environ.get("SSL_CERT_DIR"))
|
|
30
|
+
|
|
31
|
+
return ssl.create_default_context(
|
|
32
|
+
cafile=ssl_cert_file or requests_ca_bundle or certifi.where(),
|
|
33
|
+
capath=ssl_cert_dir,
|
|
34
|
+
)
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
def get_httpx_client_kwargs() -> Dict[str, Any]:
|
|
38
|
+
"""Get standardized httpx client configuration."""
|
|
39
|
+
client_kwargs: Dict[str, Any] = {"follow_redirects": True, "timeout": 30.0}
|
|
40
|
+
|
|
41
|
+
# Check environment variable to disable SSL verification
|
|
42
|
+
disable_ssl_env = os.environ.get("UIPATH_DISABLE_SSL_VERIFY", "").lower()
|
|
43
|
+
disable_ssl_from_env = disable_ssl_env in ("1", "true", "yes", "on")
|
|
44
|
+
|
|
45
|
+
if disable_ssl_from_env:
|
|
46
|
+
client_kwargs["verify"] = False
|
|
47
|
+
else:
|
|
48
|
+
# Use system certificates with truststore fallback
|
|
49
|
+
client_kwargs["verify"] = create_ssl_context()
|
|
50
|
+
|
|
51
|
+
# Auto-detect proxy from environment variables (httpx handles this automatically)
|
|
52
|
+
# HTTP_PROXY, HTTPS_PROXY, NO_PROXY are read by httpx by default
|
|
53
|
+
|
|
54
|
+
return client_kwargs
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: uipath
|
|
3
|
-
Version: 2.0.
|
|
3
|
+
Version: 2.0.74
|
|
4
4
|
Summary: Python SDK and CLI for UiPath Platform, enabling programmatic interaction with automation services, process management, and deployment tools.
|
|
5
5
|
Project-URL: Homepage, https://uipath.com
|
|
6
6
|
Project-URL: Repository, https://github.com/UiPath/uipath-python
|
|
@@ -24,6 +24,7 @@ Requires-Dist: python-dotenv>=1.0.1
|
|
|
24
24
|
Requires-Dist: rich>=13.0.0
|
|
25
25
|
Requires-Dist: tenacity>=9.0.0
|
|
26
26
|
Requires-Dist: tomli>=2.2.1
|
|
27
|
+
Requires-Dist: truststore>=0.10.1
|
|
27
28
|
Provides-Extra: langchain
|
|
28
29
|
Requires-Dist: uipath-langchain<0.1.0,>=0.0.88; extra == 'langchain'
|
|
29
30
|
Description-Content-Type: text/markdown
|
|
@@ -38,6 +39,8 @@ A Python SDK that enables programmatic interaction with UiPath Cloud Platform se
|
|
|
38
39
|
|
|
39
40
|
Use the [UiPath LangChain SDK](https://github.com/UiPath/uipath-langchain-python) to pack and publish LangGraph Agents.
|
|
40
41
|
|
|
42
|
+
Use the [UiPath LlamaIndex SDK](https://github.com/UiPath/uipath-llamaindex-python) to pack and publish LlamaIndex Agents.
|
|
43
|
+
|
|
41
44
|
This [quickstart guide](https://uipath.github.io/uipath-python/) walks you through deploying your first agent to UiPath Cloud Platform.
|
|
42
45
|
|
|
43
46
|
## Table of Contents
|
|
@@ -6,22 +6,23 @@ uipath/_uipath.py,sha256=54u-aPF29DE3fOn8yM1pjVTqSZxSSaIsifiZG9Mt_YM,3824
|
|
|
6
6
|
uipath/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
7
7
|
uipath/_cli/README.md,sha256=GLtCfbeIKZKNnGTCsfSVqRQ27V1btT1i2bSAyW_xZl4,474
|
|
8
8
|
uipath/_cli/__init__.py,sha256=vGz3vJHkUvgK9_lKdzqiwwHkge1TCALRiOzGGwyr-8E,1885
|
|
9
|
-
uipath/_cli/cli_auth.py,sha256=
|
|
9
|
+
uipath/_cli/cli_auth.py,sha256=kWk0tznOxmU6xwhJgUAMipTevH2iTIotcNiIwmPlpYI,6507
|
|
10
10
|
uipath/_cli/cli_deploy.py,sha256=KPCmQ0c_NYD5JofSDao5r6QYxHshVCRxlWDVnQvlp5w,645
|
|
11
11
|
uipath/_cli/cli_init.py,sha256=SmB7VplpXRSa5sgqgzojNsZDw0zfsEi2TfkMx3eQpTo,5132
|
|
12
|
-
uipath/_cli/cli_invoke.py,sha256=
|
|
12
|
+
uipath/_cli/cli_invoke.py,sha256=FurosrZNGlmANIrplKWhw3EQ1b46ph5Z2rPwVaYJgmc,4001
|
|
13
13
|
uipath/_cli/cli_new.py,sha256=9378NYUBc9j-qKVXV7oja-jahfJhXBg8zKVyaon7ctY,2102
|
|
14
|
-
uipath/_cli/cli_pack.py,sha256=
|
|
15
|
-
uipath/_cli/cli_publish.py,sha256=
|
|
14
|
+
uipath/_cli/cli_pack.py,sha256=qqmh7v0j4_vA4Xko5PgKFEbJIOXlmJBGd9IRnDi-wtA,17285
|
|
15
|
+
uipath/_cli/cli_publish.py,sha256=QT17JTClAyLve6ZjB-WvQaJ-j4DdmNneV_eDRyXjeeQ,6578
|
|
16
16
|
uipath/_cli/cli_run.py,sha256=zYg-9U6mkofdGsE0IGjYi1dOMlG8CdBxiVGxfFiLq5Y,5882
|
|
17
17
|
uipath/_cli/middlewares.py,sha256=f7bVODO9tgdtWNepG5L58-B-VgBSU6Ek2tIU6wLz0xA,4905
|
|
18
18
|
uipath/_cli/spinner.py,sha256=bS-U_HA5yne11ejUERu7CQoXmWdabUD2bm62EfEdV8M,1107
|
|
19
19
|
uipath/_cli/_auth/_auth_server.py,sha256=p93_EvJpdoLLkiVmLygHRKo9ru1-PZOEAaEhNFN3j6c,6424
|
|
20
|
+
uipath/_cli/_auth/_client_credentials.py,sha256=eENVb54-uzEqi7bC5VNjsiULW4fSfs-sK0kgUjRKorA,5412
|
|
20
21
|
uipath/_cli/_auth/_models.py,sha256=sYMCfvmprIqnZxStlD_Dxx2bcxgn0Ri4D7uwemwkcNg,948
|
|
21
22
|
uipath/_cli/_auth/_oidc_utils.py,sha256=WaX9jDlXrlX6yD8i8gsocV8ngjaT72Xd1tvsZMmSbco,2127
|
|
22
|
-
uipath/_cli/_auth/_portal_service.py,sha256=
|
|
23
|
+
uipath/_cli/_auth/_portal_service.py,sha256=iAxEDEY7OcEbIUSKNZnURAuNsimNmU90NLHkkTLqREY,8079
|
|
23
24
|
uipath/_cli/_auth/_utils.py,sha256=9nb76xe5XmDZ0TAncp-_1SKqL6FdwRi9eS3C2noN1lY,1591
|
|
24
|
-
uipath/_cli/_auth/auth_config.json,sha256=
|
|
25
|
+
uipath/_cli/_auth/auth_config.json,sha256=ib1qYxU6Totvl2pxFkqqmjVe3tOYR98mFFsUska9lOA,359
|
|
25
26
|
uipath/_cli/_auth/index.html,sha256=ML_xDOcKs0ETYucufJskiYfWSvdrD_E26C0Qd3qpGj8,6280
|
|
26
27
|
uipath/_cli/_auth/localhost.crt,sha256=oGl9oLLOiouHubAt39B4zEfylFvKEtbtr_43SIliXJc,1226
|
|
27
28
|
uipath/_cli/_auth/localhost.key,sha256=X31VYXD8scZtmGA837dGX5l6G-LXHLo5ItWJhZXaz3c,1679
|
|
@@ -39,18 +40,18 @@ uipath/_cli/_utils/_common.py,sha256=wQ0a_lGj0bsuNvwxUfnLwg6T3IdatdfkrPcZMoufJNU
|
|
|
39
40
|
uipath/_cli/_utils/_console.py,sha256=rj4V3yeR1wnJzFTHnaE6wcY9OoJV-PiIQnLg_p62ClQ,6664
|
|
40
41
|
uipath/_cli/_utils/_constants.py,sha256=mCeSWLURgw_dOMXjzyYBAvxKN3Vcd1vf7XKHgbdrOds,25
|
|
41
42
|
uipath/_cli/_utils/_debug.py,sha256=XlMkjtXT6hqyn7huioLDaVSYqo9fyWCvTkqEJh_ZEGw,1598
|
|
42
|
-
uipath/_cli/_utils/_folders.py,sha256=
|
|
43
|
+
uipath/_cli/_utils/_folders.py,sha256=UVJcKPfPAVR5HF4AP6EXdlNVcfEF1v5pwGCpoAgBY34,1155
|
|
43
44
|
uipath/_cli/_utils/_input_args.py,sha256=pyQhEcQXHdFHYTVNzvfWp439aii5StojoptnmCv5lfs,4094
|
|
44
45
|
uipath/_cli/_utils/_parse_ast.py,sha256=A-QToBIf-oP7yP2DQTHO6blkk6ik5z_IeaIwtEWO4e0,19516
|
|
45
|
-
uipath/_cli/_utils/_processes.py,sha256=
|
|
46
|
+
uipath/_cli/_utils/_processes.py,sha256=q7DfEKHISDWf3pngci5za_z0Pbnf_shWiYEcTOTCiyk,1855
|
|
46
47
|
uipath/_cli/_utils/_tracing.py,sha256=2igb03j3EHjF_A406UhtCKkPfudVfFPjUq5tXUEG4oo,1541
|
|
47
48
|
uipath/_services/__init__.py,sha256=10xtw3ENC30yR9CCq_b94RMZ3YrUeyfHV33yWYUd8tU,896
|
|
48
|
-
uipath/_services/_base_service.py,sha256=
|
|
49
|
+
uipath/_services/_base_service.py,sha256=7ZZDMC1TQkVk7pp-1T4a4sJOBI6O98_y9QrHN5yc8gA,5436
|
|
49
50
|
uipath/_services/actions_service.py,sha256=LYKvG4VxNGQgZ46AzGK9kI1Txb-YmVvZj5ScPOue8Ls,15989
|
|
50
51
|
uipath/_services/api_client.py,sha256=hcof0EMa4-phEHD1WlO7Tdfzq6aL18Sbi2aBE7lJm1w,1821
|
|
51
52
|
uipath/_services/assets_service.py,sha256=acqWogfhZiSO1eeVYqFxmqWGSTmrW46QxI1J0bJe3jo,11918
|
|
52
|
-
uipath/_services/attachments_service.py,sha256=
|
|
53
|
-
uipath/_services/buckets_service.py,sha256=
|
|
53
|
+
uipath/_services/attachments_service.py,sha256=Y0xJlK6UOtbG6oPLT9bW8XbfuGQPK9MEaZdMRdGA3zs,26651
|
|
54
|
+
uipath/_services/buckets_service.py,sha256=5s8tuivd7GUZYj774DDUYTa0axxlUuesc4EBY1V5sdk,18496
|
|
54
55
|
uipath/_services/connections_service.py,sha256=qh-HNL_GJsyPUD0wSJZRF8ZdrTE9l4HrIilmXGK6dDk,4581
|
|
55
56
|
uipath/_services/context_grounding_service.py,sha256=EBf7lIIYz_s1ubf_07OAZXQHjS8kpZ2vqxo4mI3VL-A,25009
|
|
56
57
|
uipath/_services/folder_service.py,sha256=9JqgjKhWD-G_KUnfUTP2BADxL6OK9QNZsBsWZHAULdE,2749
|
|
@@ -65,6 +66,7 @@ uipath/_utils/_logs.py,sha256=adfX_0UAn3YBeKJ8DQDeZs94rJyHGQO00uDfkaTpNWQ,510
|
|
|
65
66
|
uipath/_utils/_read_overwrites.py,sha256=OQgG9ycPpFnLub5ELQdX9V2Fyh6F9_zDR3xoYagJaMI,5287
|
|
66
67
|
uipath/_utils/_request_override.py,sha256=fIVHzgHVXITUlWcp8osNBwIafM1qm4_ejx0ng5UzfJ4,573
|
|
67
68
|
uipath/_utils/_request_spec.py,sha256=iCtBLqtbWUpFG5g1wtIZBzSupKsfaRLiQFoFc_4B70Q,747
|
|
69
|
+
uipath/_utils/_ssl_context.py,sha256=xSYitos0eJc9cPHzNtHISX9PBvL6D2vas5G_GiBdLp8,1783
|
|
68
70
|
uipath/_utils/_url.py,sha256=-4eluSrIZCUlnQ3qU17WPJkgaC2KwF9W5NeqGnTNGGo,2512
|
|
69
71
|
uipath/_utils/_user_agent.py,sha256=pVJkFYacGwaQBomfwWVAvBQgdBUo62e4n3-fLIajWUU,563
|
|
70
72
|
uipath/_utils/constants.py,sha256=yf4Xd0gmdisrIrsdy3zuiOgboK-XYAcrd4ekb3ZjZeE,878
|
|
@@ -91,8 +93,8 @@ uipath/tracing/__init__.py,sha256=GKRINyWdHVrDsI-8mrZDLdf0oey6GHGlNZTOADK-kgc,22
|
|
|
91
93
|
uipath/tracing/_otel_exporters.py,sha256=x0PDPmDKJcxashsuehVsSsqBCzRr6WsNFaq_3_HS5F0,3014
|
|
92
94
|
uipath/tracing/_traced.py,sha256=qeVDrds2OUnpdUIA0RhtF0kg2dlAZhyC1RRkI-qivTM,18528
|
|
93
95
|
uipath/tracing/_utils.py,sha256=ZeensQexnw69jVcsVrGyED7mPlAU-L1agDGm6_1A3oc,10388
|
|
94
|
-
uipath-2.0.
|
|
95
|
-
uipath-2.0.
|
|
96
|
-
uipath-2.0.
|
|
97
|
-
uipath-2.0.
|
|
98
|
-
uipath-2.0.
|
|
96
|
+
uipath-2.0.74.dist-info/METADATA,sha256=7nWW75xzek2vV6C_UQZiJKFUMFkwdxDP58_y3FYn-n0,6462
|
|
97
|
+
uipath-2.0.74.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
98
|
+
uipath-2.0.74.dist-info/entry_points.txt,sha256=9C2_29U6Oq1ExFu7usihR-dnfIVNSKc-0EFbh0rskB4,43
|
|
99
|
+
uipath-2.0.74.dist-info/licenses/LICENSE,sha256=-KBavWXepyDjimmzH5fVAsi-6jNVpIKFc2kZs0Ri4ng,1058
|
|
100
|
+
uipath-2.0.74.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|