uipath 2.1.23__py3-none-any.whl → 2.1.25__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.
uipath/_cli/__init__.py CHANGED
@@ -3,7 +3,7 @@ import sys
3
3
 
4
4
  import click
5
5
 
6
- from .cli_auth import auth as auth # type: ignore
6
+ from .cli_auth import auth as auth
7
7
  from .cli_deploy import deploy as deploy # type: ignore
8
8
  from .cli_eval import eval as eval # type: ignore
9
9
  from .cli_init import init as init # type: ignore
@@ -70,7 +70,7 @@ class ClientCredentialsService:
70
70
  return "cloud"
71
71
 
72
72
  def authenticate(
73
- self, client_id: str, client_secret: str, scope: str = "OR.Execution"
73
+ self, client_id: str, client_secret: str, scope: Optional[str] = "OR.Execution"
74
74
  ) -> Optional[TokenData]:
75
75
  """Authenticate using client credentials flow.
76
76
 
@@ -5,6 +5,7 @@ import os
5
5
  from urllib.parse import urlencode
6
6
 
7
7
  from ._models import AuthConfig
8
+ from ._url_utils import build_service_url
8
9
 
9
10
 
10
11
  def generate_code_verifier_and_challenge():
@@ -65,5 +66,5 @@ def get_auth_url(domain: str) -> tuple[str, str, str]:
65
66
  }
66
67
 
67
68
  query_string = urlencode(query_params)
68
- url = f"https://{domain}.uipath.com/identity_/connect/authorize?{query_string}"
69
+ url = build_service_url(domain, f"/identity_/connect/authorize?{query_string}")
69
70
  return url, code_verifier, state
@@ -9,6 +9,7 @@ from ..._utils._ssl_context import get_httpx_client_kwargs
9
9
  from .._utils._console import ConsoleLogger
10
10
  from ._models import TenantsAndOrganizationInfoResponse, TokenData
11
11
  from ._oidc_utils import get_auth_config
12
+ from ._url_utils import build_service_url, get_base_url
12
13
  from ._utils import (
13
14
  get_auth_data,
14
15
  get_parsed_token_data,
@@ -24,7 +25,7 @@ class PortalService:
24
25
 
25
26
  access_token: Optional[str] = None
26
27
  prt_id: Optional[str] = None
27
- domain: Optional[str] = None
28
+ domain: str
28
29
  selected_tenant: Optional[str] = None
29
30
 
30
31
  _client: Optional[httpx.Client] = None
@@ -65,7 +66,10 @@ class PortalService:
65
66
  if self._client is None:
66
67
  raise RuntimeError("HTTP client is not initialized")
67
68
 
68
- url = f"https://{self.domain}.uipath.com/{self.prt_id}/portal_/api/filtering/leftnav/tenantsAndOrganizationInfo"
69
+ url = build_service_url(
70
+ self.domain,
71
+ f"/{self.prt_id}/portal_/api/filtering/leftnav/tenantsAndOrganizationInfo",
72
+ )
69
73
  response = self._client.get(
70
74
  url, headers={"Authorization": f"Bearer {self.access_token}"}
71
75
  )
@@ -90,13 +94,14 @@ class PortalService:
90
94
  console.error("Organization not found.")
91
95
  return ""
92
96
  account_name = organization.get("name")
93
- return f"https://{self.domain}.uipath.com/{account_name}/{self.selected_tenant}/orchestrator_"
97
+ base_url = get_base_url(self.domain)
98
+ return f"{base_url}/{account_name}/{self.selected_tenant}/orchestrator_"
94
99
 
95
100
  def post_refresh_token_request(self, refresh_token: str) -> TokenData:
96
101
  if self._client is None:
97
102
  raise RuntimeError("HTTP client is not initialized")
98
103
 
99
- url = f"https://{self.domain}.uipath.com/identity_/connect/token"
104
+ url = build_service_url(self.domain, "/identity_/connect/token")
100
105
  client_id = get_auth_config().get("client_id")
101
106
 
102
107
  data = {
@@ -213,12 +218,15 @@ def select_tenant(
213
218
  account_name = tenants_and_organizations["organization"]["name"]
214
219
  console.info(f"Selected tenant: {click.style(tenant_name, fg='cyan')}")
215
220
 
221
+ base_url = get_base_url(domain)
222
+ uipath_url = f"{base_url}/{account_name}/{tenant_name}"
223
+
216
224
  update_env_file(
217
225
  {
218
- "UIPATH_URL": f"https://{domain if domain else 'alpha'}.uipath.com/{account_name}/{tenant_name}",
226
+ "UIPATH_URL": uipath_url,
219
227
  "UIPATH_TENANT_ID": tenants_and_organizations["tenants"][tenant_idx]["id"],
220
228
  "UIPATH_ORGANIZATION_ID": tenants_and_organizations["organization"]["id"],
221
229
  }
222
230
  )
223
231
 
224
- return f"https://{domain if domain else 'alpha'}.uipath.com/{account_name}/{tenant_name}"
232
+ return uipath_url
@@ -0,0 +1,41 @@
1
+ import os
2
+ from urllib.parse import urlparse
3
+
4
+
5
+ def get_base_url(domain: str) -> str:
6
+ """Get the base URL for UiPath services.
7
+
8
+ Args:
9
+ domain: Either a domain name (e.g., 'cloud', 'alpha') or a full URL from UIPATH_URL
10
+
11
+ Returns:
12
+ The base URL to use for UiPath services
13
+ """
14
+ # If UIPATH_URL is set and domain is 'cloud' (default), use the base from UIPATH_URL
15
+ uipath_url = os.getenv("UIPATH_URL")
16
+ if uipath_url and domain == "cloud":
17
+ parsed_url = urlparse(uipath_url)
18
+ return f"{parsed_url.scheme}://{parsed_url.netloc}"
19
+
20
+ # If domain is already a full URL, use it directly
21
+ if domain.startswith("http"):
22
+ return domain
23
+
24
+ # Otherwise, construct the URL using the domain
25
+ return f"https://{domain if domain else 'cloud'}.uipath.com"
26
+
27
+
28
+ def build_service_url(domain: str, path: str) -> str:
29
+ """Build a service URL by combining the base URL with a path.
30
+
31
+ Args:
32
+ domain: Either a domain name or full URL
33
+ path: The path to append (should start with /)
34
+
35
+ Returns:
36
+ The complete service URL
37
+ """
38
+ base_url = get_base_url(domain)
39
+ # Remove trailing slash from base_url to avoid double slashes
40
+ base_url = base_url.rstrip("/")
41
+ return f"{base_url}{path}"
@@ -477,7 +477,15 @@
477
477
  formData.append('client_id', '__PY_REPLACE_CLIENT_ID__');
478
478
  formData.append('code_verifier', codeVerifier);
479
479
 
480
- const response = await fetch('https://__PY_REPLACE_DOMAIN__.uipath.com/identity_/connect/token', {
480
+ const domainOrUrl = '__PY_REPLACE_DOMAIN__';
481
+ let tokenUrl;
482
+ if (domainOrUrl.startsWith('http')) {
483
+ tokenUrl = `${domainOrUrl}/identity_/connect/token`;
484
+ } else {
485
+ tokenUrl = `https://${domainOrUrl}.uipath.com/identity_/connect/token`;
486
+ }
487
+
488
+ const response = await fetch(tokenUrl, {
481
489
  method: 'POST',
482
490
  headers: {
483
491
  'Content-Type': 'application/x-www-form-urlencoded'
uipath/_cli/cli_auth.py CHANGED
@@ -1,9 +1,10 @@
1
- # type: ignore
2
1
  import asyncio
3
2
  import json
4
3
  import os
5
4
  import socket
6
5
  import webbrowser
6
+ from typing import Optional
7
+ from urllib.parse import urlparse
7
8
 
8
9
  import click
9
10
  from dotenv import load_dotenv
@@ -33,10 +34,10 @@ def is_port_in_use(port: int) -> bool:
33
34
 
34
35
  def set_port():
35
36
  auth_config = get_auth_config()
36
- port = auth_config.get("port", 8104)
37
- port_option_one = auth_config.get("portOptionOne", 8104)
38
- port_option_two = auth_config.get("portOptionTwo", 8055)
39
- port_option_three = auth_config.get("portOptionThree", 42042)
37
+ port = int(auth_config.get("port", 8104))
38
+ port_option_one = int(auth_config.get("portOptionOne", 8104)) # type: ignore
39
+ port_option_two = int(auth_config.get("portOptionTwo", 8055)) # type: ignore
40
+ port_option_three = int(auth_config.get("portOptionThree", 42042)) # type: ignore
40
41
  if is_port_in_use(port):
41
42
  if is_port_in_use(port_option_one):
42
43
  if is_port_in_use(port_option_two):
@@ -81,24 +82,45 @@ def set_port():
81
82
  required=False,
82
83
  help="Base URL for the UiPath tenant instance (required for client credentials)",
83
84
  )
85
+ @click.option(
86
+ "--scope",
87
+ required=False,
88
+ default="OR.Execution",
89
+ help="Space-separated list of OAuth scopes to request (e.g., 'OR.Execution OR.Queues'). Defaults to 'OR.Execution'",
90
+ )
84
91
  @track
85
92
  def auth(
86
93
  domain,
87
- force: None | bool = False,
88
- client_id: str = None,
89
- client_secret: str = None,
90
- base_url: str = None,
94
+ force: Optional[bool] = False,
95
+ client_id: Optional[str] = None,
96
+ client_secret: Optional[str] = None,
97
+ base_url: Optional[str] = None,
98
+ scope: Optional[str] = None,
91
99
  ):
92
100
  """Authenticate with UiPath Cloud Platform.
93
101
 
102
+ The domain for authentication is determined by the UIPATH_URL environment variable if set.
103
+ Otherwise, it can be specified with --cloud (default), --staging, or --alpha flags.
104
+
94
105
  Interactive mode (default): Opens browser for OAuth authentication.
95
- Unattended mode: Use --client-id, --client-secret and --base-url for client credentials flow.
106
+ Unattended mode: Use --client-id, --client-secret, --base-url and --scope for client credentials flow.
96
107
 
97
108
  Network options:
98
109
  - Set HTTP_PROXY/HTTPS_PROXY/NO_PROXY environment variables for proxy configuration
99
110
  - Set REQUESTS_CA_BUNDLE to specify a custom CA bundle for SSL verification
100
111
  - Set UIPATH_DISABLE_SSL_VERIFY to disable SSL verification (not recommended)
101
112
  """
113
+ uipath_url = os.getenv("UIPATH_URL")
114
+ if uipath_url and domain == "cloud": # "cloud" is the default
115
+ parsed_url = urlparse(uipath_url)
116
+ if parsed_url.scheme and parsed_url.netloc:
117
+ domain = f"{parsed_url.scheme}://{parsed_url.netloc}"
118
+ else:
119
+ console.error(
120
+ f"Malformed UIPATH_URL: '{uipath_url}'. Please ensure it includes both scheme and netloc (e.g., 'https://cloud.uipath.com')."
121
+ )
122
+ return
123
+
102
124
  # Check if client credentials are provided for unattended authentication
103
125
  if client_id and client_secret:
104
126
  if not base_url:
@@ -117,7 +139,9 @@ def auth(
117
139
  )
118
140
  credentials_service.domain = extracted_domain
119
141
 
120
- token_data = credentials_service.authenticate(client_id, client_secret)
142
+ token_data = credentials_service.authenticate(
143
+ client_id, client_secret, scope
144
+ )
121
145
 
122
146
  if token_data:
123
147
  credentials_service.setup_environment(token_data, base_url)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: uipath
3
- Version: 2.1.23
3
+ Version: 2.1.25
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
@@ -5,8 +5,8 @@ uipath/_folder_context.py,sha256=UMMoU1VWEfYHAZW3Td2SIFYhw5dYsmaaKFhW_JEm6oc,192
5
5
  uipath/_uipath.py,sha256=ZfEcqpY7NRSm6rB2OPgyVXBl9DCnn750ikq8VzzTO_s,4146
6
6
  uipath/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
7
7
  uipath/_cli/README.md,sha256=GLtCfbeIKZKNnGTCsfSVqRQ27V1btT1i2bSAyW_xZl4,474
8
- uipath/_cli/__init__.py,sha256=oG0oTrb60qfIncJ0EcGsytBYxAVbepcBlOkqBKQlsJM,2104
9
- uipath/_cli/cli_auth.py,sha256=RUSBHfmqhBtITrx52FeXMlVCuNyo8vrjTdjEhmM1Khw,6734
8
+ uipath/_cli/__init__.py,sha256=eMtRrLZO6DyNaDcbatrp0FvIQo6BuMWeTOgZm9kzkMo,2088
9
+ uipath/_cli/cli_auth.py,sha256=-KgyI_IKWNWoEUFr4GxrQJF9qQHSYqTGvjNOj1mkxPc,7831
10
10
  uipath/_cli/cli_deploy.py,sha256=KPCmQ0c_NYD5JofSDao5r6QYxHshVCRxlWDVnQvlp5w,645
11
11
  uipath/_cli/cli_eval.py,sha256=INkfaZKadShtFOrVfTNM7K2kjXV-cwIqsOfIEYqDSGc,3656
12
12
  uipath/_cli/cli_init.py,sha256=jksza6bHfh4z1nKyEJBEEZlkO37yZoCz_FJWq_RPhWI,6093
@@ -20,13 +20,14 @@ uipath/_cli/cli_run.py,sha256=1W3cPMgaVzm1wTnTD4-tJQwJ5h4riKRUBQb1hzsGMcw,7767
20
20
  uipath/_cli/middlewares.py,sha256=CN-QqV69zZPI-hvizvEIb-zTcNh9WjsZIYCF3_nHSio,4915
21
21
  uipath/_cli/spinner.py,sha256=bS-U_HA5yne11ejUERu7CQoXmWdabUD2bm62EfEdV8M,1107
22
22
  uipath/_cli/_auth/_auth_server.py,sha256=Wx3TaK5QvGzaJytp2cnYO3NFVIvTsNqxfVMwBquEyQs,7162
23
- uipath/_cli/_auth/_client_credentials.py,sha256=eENVb54-uzEqi7bC5VNjsiULW4fSfs-sK0kgUjRKorA,5412
23
+ uipath/_cli/_auth/_client_credentials.py,sha256=aC_xtEzWBQohRlxt85ZE8Ro0Pv9LmNltXECV8yjjO0U,5422
24
24
  uipath/_cli/_auth/_models.py,sha256=sYMCfvmprIqnZxStlD_Dxx2bcxgn0Ri4D7uwemwkcNg,948
25
- uipath/_cli/_auth/_oidc_utils.py,sha256=WaX9jDlXrlX6yD8i8gsocV8ngjaT72Xd1tvsZMmSbco,2127
26
- uipath/_cli/_auth/_portal_service.py,sha256=iAxEDEY7OcEbIUSKNZnURAuNsimNmU90NLHkkTLqREY,8079
25
+ uipath/_cli/_auth/_oidc_utils.py,sha256=tsYuueJoAYgS9d_ly0b3RmQ4Yybhr4G7ZkAc6lf8Gck,2169
26
+ uipath/_cli/_auth/_portal_service.py,sha256=-985pkS9N9lMelesAz4hJUzgWDyf4L4ie4sv3-iklGE,8128
27
+ uipath/_cli/_auth/_url_utils.py,sha256=OmCGMukMfpMGtq3zoqqhD9WR5n0RlkXnH5BTFXOcbQ4,1307
27
28
  uipath/_cli/_auth/_utils.py,sha256=9nb76xe5XmDZ0TAncp-_1SKqL6FdwRi9eS3C2noN1lY,1591
28
29
  uipath/_cli/_auth/auth_config.json,sha256=UnAhdum8phjuZaZKE5KLp0IcPCbIltDEU1M_G8gVbos,443
29
- uipath/_cli/_auth/index.html,sha256=_Q2OtqPfapG_6vumbQYqtb2PfFe0smk7TlGERKEBvB4,22518
30
+ uipath/_cli/_auth/index.html,sha256=uGK0CDTP8Rys_p4O_Pbd2x4tz0frKNVcumjrXnal5Nc,22814
30
31
  uipath/_cli/_auth/localhost.crt,sha256=oGl9oLLOiouHubAt39B4zEfylFvKEtbtr_43SIliXJc,1226
31
32
  uipath/_cli/_auth/localhost.key,sha256=X31VYXD8scZtmGA837dGX5l6G-LXHLo5ItWJhZXaz3c,1679
32
33
  uipath/_cli/_evals/evaluation_service.py,sha256=zqYRB-tZpTTFqMctjIpEli3joIlmrz3dCVZsxekxIps,22053
@@ -115,8 +116,8 @@ uipath/tracing/_traced.py,sha256=qeVDrds2OUnpdUIA0RhtF0kg2dlAZhyC1RRkI-qivTM,185
115
116
  uipath/tracing/_utils.py,sha256=wJRELaPu69iY0AhV432Dk5QYf_N_ViRU4kAUG1BI1ew,10384
116
117
  uipath/utils/__init__.py,sha256=VD-KXFpF_oWexFg6zyiWMkxl2HM4hYJMIUDZ1UEtGx0,105
117
118
  uipath/utils/_endpoints_manager.py,sha256=iRTl5Q0XAm_YgcnMcJOXtj-8052sr6jpWuPNz6CgT0Q,8408
118
- uipath-2.1.23.dist-info/METADATA,sha256=CEP-ypBLLKYH4Tkpc9iWDIUx-uWRHty7PqgnuX3CcTg,6367
119
- uipath-2.1.23.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
120
- uipath-2.1.23.dist-info/entry_points.txt,sha256=9C2_29U6Oq1ExFu7usihR-dnfIVNSKc-0EFbh0rskB4,43
121
- uipath-2.1.23.dist-info/licenses/LICENSE,sha256=-KBavWXepyDjimmzH5fVAsi-6jNVpIKFc2kZs0Ri4ng,1058
122
- uipath-2.1.23.dist-info/RECORD,,
119
+ uipath-2.1.25.dist-info/METADATA,sha256=07yw-KMr0bRb2bR0C7iJrYPf3fi4qEhYyVUeezOackA,6367
120
+ uipath-2.1.25.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
121
+ uipath-2.1.25.dist-info/entry_points.txt,sha256=9C2_29U6Oq1ExFu7usihR-dnfIVNSKc-0EFbh0rskB4,43
122
+ uipath-2.1.25.dist-info/licenses/LICENSE,sha256=-KBavWXepyDjimmzH5fVAsi-6jNVpIKFc2kZs0Ri4ng,1058
123
+ uipath-2.1.25.dist-info/RECORD,,