uipath 2.0.5__py3-none-any.whl → 2.0.7__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/_folder_context.py CHANGED
@@ -46,17 +46,12 @@ class FolderContext:
46
46
 
47
47
  Returns:
48
48
  dict[str, str]: A dictionary containing the appropriate folder
49
- header (either folder key or folder path).
50
-
51
- Raises:
52
- ValueError: If neither folder key nor folder path is set in
53
- the environment.
49
+ header (either folder key or folder path). If no folder header is
50
+ set as environment variable, the function returns an empty dictionary.
54
51
  """
55
52
  if self._folder_key is not None:
56
53
  return {HEADER_FOLDER_KEY: self._folder_key}
57
54
  elif self._folder_path is not None:
58
55
  return {HEADER_FOLDER_PATH: self._folder_path}
59
56
  else:
60
- raise ValueError(
61
- f"Folder key or path is not set ({ENV_FOLDER_KEY} or {ENV_FOLDER_PATH})"
62
- )
57
+ return {}
@@ -7,17 +7,24 @@ 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
10
- from .._utils.constants import ENV_TENANT_ID, HEADER_TENANT_ID
10
+ from .._utils.constants import (
11
+ ENV_TENANT_ID,
12
+ HEADER_FOLDER_KEY,
13
+ HEADER_FOLDER_PATH,
14
+ HEADER_TENANT_ID,
15
+ )
11
16
  from ..models import Action, ActionSchema
12
17
  from ._base_service import BaseService
13
18
 
14
19
 
15
20
  def _create_spec(
16
- title: str,
17
21
  data: Optional[Dict[str, Any]],
18
22
  action_schema: Optional[ActionSchema],
23
+ title: str,
19
24
  app_key: str = "",
20
25
  app_version: int = -1,
26
+ app_folder_key: str = "",
27
+ app_folder_path: str = "",
21
28
  ) -> RequestSpec:
22
29
  field_list = []
23
30
  outcome_list = []
@@ -97,14 +104,18 @@ def _create_spec(
97
104
  else {},
98
105
  }
99
106
  ),
107
+ headers=folder_headers(app_folder_key, app_folder_path),
100
108
  )
101
109
 
102
110
 
103
- def _retrieve_action_spec(action_key: str) -> RequestSpec:
111
+ def _retrieve_action_spec(
112
+ action_key: str, app_folder_key: str, app_folder_path: str
113
+ ) -> RequestSpec:
104
114
  return RequestSpec(
105
115
  method="GET",
106
116
  endpoint=Endpoint("/orchestrator_/tasks/GenericTasks/GetTaskDataByKey"),
107
117
  params={"taskKey": action_key},
118
+ headers=folder_headers(app_folder_key, app_folder_path),
108
119
  )
109
120
 
110
121
 
@@ -132,6 +143,15 @@ def _retrieve_app_key_spec(app_name: str) -> RequestSpec:
132
143
  )
133
144
 
134
145
 
146
+ def folder_headers(app_folder_key: str, app_folder_path: str) -> Dict[str, str]:
147
+ headers = {}
148
+ if app_folder_key:
149
+ headers[HEADER_FOLDER_KEY] = app_folder_key
150
+ elif app_folder_path:
151
+ headers[HEADER_FOLDER_PATH] = app_folder_path
152
+ return headers
153
+
154
+
135
155
  class ActionsService(FolderContext, BaseService):
136
156
  """Service for managing UiPath Actions.
137
157
 
@@ -162,6 +182,8 @@ class ActionsService(FolderContext, BaseService):
162
182
  *,
163
183
  app_name: str = "",
164
184
  app_key: str = "",
185
+ app_folder_path: str = "",
186
+ app_folder_key: str = "",
165
187
  app_version: int = -1,
166
188
  assignee: str = "",
167
189
  ) -> Action:
@@ -175,6 +197,8 @@ class ActionsService(FolderContext, BaseService):
175
197
  data: Optional dictionary containing input data for the action
176
198
  app_name: The name of the application (if creating an app-specific action)
177
199
  app_key: The key of the application (if creating an app-specific action)
200
+ app_folder_path: Optional folder path for the action
201
+ app_folder_key: Optional folder key for the action
178
202
  app_version: The version of the application
179
203
  assignee: Optional username or email to assign the task to
180
204
 
@@ -195,10 +219,12 @@ class ActionsService(FolderContext, BaseService):
195
219
  app_key=key,
196
220
  app_version=app_version,
197
221
  action_schema=action_schema,
222
+ app_folder_key=app_folder_key,
223
+ app_folder_path=app_folder_path,
198
224
  )
199
225
 
200
226
  response = await self.request_async(
201
- spec.method, spec.endpoint, content=spec.content
227
+ spec.method, spec.endpoint, content=spec.content, headers=spec.headers
202
228
  )
203
229
  json_response = response.json()
204
230
  if assignee:
@@ -213,6 +239,8 @@ class ActionsService(FolderContext, BaseService):
213
239
  *,
214
240
  app_name: str = "",
215
241
  app_key: str = "",
242
+ app_folder_path: str = "",
243
+ app_folder_key: str = "",
216
244
  app_version: int = -1,
217
245
  assignee: str = "",
218
246
  ) -> Action:
@@ -226,6 +254,8 @@ class ActionsService(FolderContext, BaseService):
226
254
  data: Optional dictionary containing input data for the action
227
255
  app_name: The name of the application (if creating an app-specific action)
228
256
  app_key: The key of the application (if creating an app-specific action)
257
+ app_folder_path: Optional folder path for the action
258
+ app_folder_key: Optional folder key for the action
229
259
  app_version: The version of the application
230
260
  assignee: Optional username or email to assign the task to
231
261
 
@@ -244,48 +274,63 @@ class ActionsService(FolderContext, BaseService):
244
274
  app_key=key,
245
275
  app_version=app_version,
246
276
  action_schema=action_schema,
277
+ app_folder_key=app_folder_key,
278
+ app_folder_path=app_folder_path,
247
279
  )
248
280
 
249
- response = self.request(spec.method, spec.endpoint, content=spec.content)
281
+ response = self.request(
282
+ spec.method, spec.endpoint, content=spec.content, headers=spec.headers
283
+ )
250
284
  json_response = response.json()
251
285
  if assignee:
252
286
  spec = _assign_task_spec(json_response["id"], assignee)
253
- print(spec)
254
287
  self.request(spec.method, spec.endpoint, content=spec.content)
255
288
  return Action.model_validate(json_response)
256
289
 
257
290
  def retrieve(
258
- self,
259
- action_key: str,
291
+ self, action_key: str, app_folder_path: str = "", app_folder_key: str = ""
260
292
  ) -> Action:
261
293
  """Retrieves an action by its key synchronously.
262
294
 
263
295
  Args:
264
296
  action_key: The unique identifier of the action to retrieve
297
+ app_folder_path: Optional folder path for the action
298
+ app_folder_key: Optional folder key for the action
265
299
 
266
300
  Returns:
267
301
  Action: The retrieved action object
268
302
  """
269
- spec = _retrieve_action_spec(action_key=action_key)
270
- response = self.request(spec.method, spec.endpoint, params=spec.params)
303
+ spec = _retrieve_action_spec(
304
+ action_key=action_key,
305
+ app_folder_key=app_folder_key,
306
+ app_folder_path=app_folder_path,
307
+ )
308
+ response = self.request(
309
+ spec.method, spec.endpoint, params=spec.params, headers=spec.headers
310
+ )
271
311
 
272
312
  return Action.model_validate(response.json())
273
313
 
274
314
  async def retrieve_async(
275
- self,
276
- action_key: str,
315
+ self, action_key: str, app_folder_path: str = "", app_folder_key: str = ""
277
316
  ) -> Action:
278
317
  """Retrieves an action by its key asynchronously.
279
318
 
280
319
  Args:
281
320
  action_key: The unique identifier of the action to retrieve
321
+ app_folder_path: Optional folder path for the action
322
+ app_folder_key: Optional folder key for the action
282
323
 
283
324
  Returns:
284
325
  Action: The retrieved action object
285
326
  """
286
- spec = _retrieve_action_spec(action_key=action_key)
327
+ spec = _retrieve_action_spec(
328
+ action_key=action_key,
329
+ app_folder_key=app_folder_key,
330
+ app_folder_path=app_folder_path,
331
+ )
287
332
  response = await self.request_async(
288
- spec.method, spec.endpoint, params=spec.params
333
+ spec.method, spec.endpoint, params=spec.params, headers=spec.headers
289
334
  )
290
335
 
291
336
  return Action.model_validate(response.json())
@@ -311,8 +356,25 @@ class ActionsService(FolderContext, BaseService):
311
356
  response = await self.request_org_scope_async(
312
357
  spec.method, spec.endpoint, params=spec.params, headers=spec.headers
313
358
  )
314
- deployed_app = response.json()["deployed"][0]
315
- return (deployed_app["systemName"], deployed_app["actionSchema"])
359
+ try:
360
+ deployed_app = response.json()["deployed"][0]
361
+ action_schema = deployed_app["actionSchema"]
362
+ deployed_app_key = deployed_app["systemName"]
363
+ except (KeyError, IndexError):
364
+ raise Exception("Action app not found") from None
365
+ try:
366
+ return (
367
+ deployed_app_key,
368
+ ActionSchema(
369
+ key=action_schema["key"],
370
+ in_outs=action_schema["inOuts"],
371
+ inputs=action_schema["inputs"],
372
+ outputs=action_schema["outputs"],
373
+ outcomes=action_schema["outcomes"],
374
+ ),
375
+ )
376
+ except KeyError:
377
+ raise Exception("Failed to deserialize action schema") from KeyError
316
378
 
317
379
  def __get_app_key_and_schema(
318
380
  self, app_name: str
@@ -326,18 +388,25 @@ class ActionsService(FolderContext, BaseService):
326
388
  spec.method, spec.endpoint, params=spec.params, headers=spec.headers
327
389
  )
328
390
 
329
- deployed_app = response.json()["deployed"][0]
330
- action_schema = deployed_app["actionSchema"]
331
- return (
332
- deployed_app["systemName"],
333
- ActionSchema(
334
- key=action_schema["key"],
335
- in_outs=action_schema["inOuts"],
336
- inputs=action_schema["inputs"],
337
- outputs=action_schema["outputs"],
338
- outcomes=action_schema["outcomes"],
339
- ),
340
- )
391
+ try:
392
+ deployed_app = response.json()["deployed"][0]
393
+ action_schema = deployed_app["actionSchema"]
394
+ deployed_app_key = deployed_app["systemName"]
395
+ except (KeyError, IndexError):
396
+ raise Exception("Action app not found") from None
397
+ try:
398
+ return (
399
+ deployed_app_key,
400
+ ActionSchema(
401
+ key=action_schema["key"],
402
+ in_outs=action_schema["inOuts"],
403
+ inputs=action_schema["inputs"],
404
+ outputs=action_schema["outputs"],
405
+ outcomes=action_schema["outcomes"],
406
+ ),
407
+ )
408
+ except KeyError:
409
+ raise Exception("Failed to deserialize action schema") from KeyError
341
410
 
342
411
  @property
343
412
  def custom_headers(self) -> Dict[str, str]:
@@ -9,6 +9,7 @@ from .._folder_context import FolderContext
9
9
  from .._utils import Endpoint, RequestSpec
10
10
  from .._utils.constants import (
11
11
  HEADER_FOLDER_KEY,
12
+ HEADER_FOLDER_PATH,
12
13
  ORCHESTRATOR_STORAGE_BUCKET_DATA_SOURCE,
13
14
  )
14
15
  from ..models import IngestionInProgressException
@@ -326,7 +327,9 @@ class ContextGroundingService(FolderContext, BaseService):
326
327
  )
327
328
 
328
329
  if self._folder_key is None:
329
- raise ValueError(f"Folder key is not set ({HEADER_FOLDER_KEY})")
330
+ raise ValueError(
331
+ f"Neither the folder key nor the folder path is set ({HEADER_FOLDER_KEY}, {HEADER_FOLDER_PATH})"
332
+ )
330
333
 
331
334
  return self.folder_headers
332
335
 
@@ -16,12 +16,14 @@ class WaitJob(BaseModel):
16
16
 
17
17
 
18
18
  class CreateAction(BaseModel):
19
- name: Optional[str] = None
20
- key: Optional[str] = None
21
19
  title: str
22
20
  data: Optional[Dict[str, Any]] = None
23
- app_version: Optional[int] = 1
24
21
  assignee: Optional[str] = ""
22
+ app_name: Optional[str] = None
23
+ app_folder_path: Optional[str] = None
24
+ app_folder_key: Optional[str] = None
25
+ app_key: Optional[str] = None
26
+ app_version: Optional[int] = 1
25
27
 
26
28
 
27
29
  class WaitAction(BaseModel):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: uipath
3
- Version: 2.0.5
3
+ Version: 2.0.7
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
@@ -208,4 +208,4 @@ To properly use the CLI for packaging and publishing, your project should includ
208
208
 
209
209
  ### Setting Up a Development Environment
210
210
 
211
- Please read [CONTRIBUTING.md](https://uipath.github.io/uipath-python/how_to_contribute/) before submitting a pull request.
211
+ Please read [CONTRIBUTING.md](./CONTRIBUTING.md) before submitting a pull request.
@@ -1,7 +1,7 @@
1
1
  uipath/__init__.py,sha256=IaeKItOOQXMa95avueJ3dAq-XcRHyZVNjcCGwlSB000,634
2
2
  uipath/_config.py,sha256=pi3qxPzDTxMEstj_XkGOgKJqD6RTHHv7vYv8sS_-d5Q,92
3
3
  uipath/_execution_context.py,sha256=JkmMH51ck4p-JQtgJeDvpBP-BZNIN_1h3Qlo8QrPr-w,2421
4
- uipath/_folder_context.py,sha256=DmCXHLCmyZWIdAqRnMOfXE-9BAyVLu4CYTeaMXrPqa0,2031
4
+ uipath/_folder_context.py,sha256=oxX7o8ilU9sA_vEKLr2sZZCHnvRwJ0_as-LOMc4hxc4,1908
5
5
  uipath/_uipath.py,sha256=D9UWyRInN2Q8HFEQtYaYzT3DCZ3tW_OCBs_4RRqRVuY,2795
6
6
  uipath/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
7
7
  uipath/_cli/README.md,sha256=GLtCfbeIKZKNnGTCsfSVqRQ27V1btT1i2bSAyW_xZl4,474
@@ -36,13 +36,13 @@ uipath/_cli/_utils/_input_args.py,sha256=pyQhEcQXHdFHYTVNzvfWp439aii5StojoptnmCv
36
36
  uipath/_cli/_utils/_parse_ast.py,sha256=3XVjnhJNnSfjXlitct91VOtqSl0l-sqDpoWww28mMc0,20663
37
37
  uipath/_services/__init__.py,sha256=VPbwLDsvN26nWZgvR-8_-tc3i0rk5doqjTJbSrK0nN4,818
38
38
  uipath/_services/_base_service.py,sha256=3YClCoZBkVQGNJZGy-4NTk-HGsGA61XtwVQFYv9mwWk,7955
39
- uipath/_services/actions_service.py,sha256=HMOzbmzj7sO6w63KMuRjvZYl3L3gttzyJhzV5BcaC5U,11881
39
+ uipath/_services/actions_service.py,sha256=muTw0jJ71pyLyrnzMZ-QIKjcmHEsLSzpd_UCLTAIrFM,14685
40
40
  uipath/_services/api_client.py,sha256=1hYLc_90dQzCGnqqirEHpPqvL3Gkv2sSKoeOV_iTmlk,2903
41
41
  uipath/_services/assets_service.py,sha256=OdnhlHfEmwA0SQqkXO4XHl3bV26QLgIxj6sFycseZ0g,8647
42
42
  uipath/_services/buckets_service.py,sha256=JeSFoEOBeGi-i_aevaMAyu5gpauq1KC_JkANRTmyxEs,8655
43
43
  uipath/_services/connections_service.py,sha256=J_eKhMuBmiDKIhr5bA4_9g8xND185lh_MuBh2hmWMs4,6853
44
44
  uipath/_services/connections_service.pyi,sha256=6OOnh0aCfxhETL8n_JZ6Xoe2BE3ST_7Vz-FgLZc53lM,2465
45
- uipath/_services/context_grounding_service.py,sha256=YMKRrit4TsU4--pVR7O6eiLxhSwuxPuaVvU0prlYzg0,13268
45
+ uipath/_services/context_grounding_service.py,sha256=eYxmkfBkLIxbMypBEzvyQ6_Jh7PF3OCrwzIe0PQXIs8,13372
46
46
  uipath/_services/folder_service.py,sha256=1BRTnfA-iMzAGZTJqTUtOXzNZLzbGCoWpH3g45YBEuQ,1556
47
47
  uipath/_services/jobs_service.py,sha256=iNs4hvr8Qyy_zbJjEkPK-0ygCM1l0OqpD1D_0PRgmf4,8126
48
48
  uipath/_services/llm_gateway_service.py,sha256=1YCgW2c0Hh3uXctUKPLcytAMJe4Qk_L8LLCd8Plgvvs,11695
@@ -64,13 +64,13 @@ uipath/models/connections.py,sha256=perIqW99YEg_0yWZPdpZlmNpZcwY_toR1wkqDUBdAN0,
64
64
  uipath/models/context_grounding.py,sha256=ak3cjlA90X1FceAAI0ry4jioTtK6Zxo0oqmKY_xs8bo,352
65
65
  uipath/models/context_grounding_index.py,sha256=vHBu069j1Y1m5PydLj6uoVH0rNIxuOohKLknHn5KvQw,2508
66
66
  uipath/models/exceptions.py,sha256=WEUw2_sh-aE0HDiqPoBZyh9KIk1BaDFY5O7Lzo8KRws,324
67
- uipath/models/interrupt_models.py,sha256=KcUD7YeUCMHOiunbnLbHZdSjivdO5yQ8hachQ_IR1Wg,525
67
+ uipath/models/interrupt_models.py,sha256=06c8kp_qexhR2YULH5fJ4PZH-d1scBSEB07vPDmDnQI,616
68
68
  uipath/models/job.py,sha256=f9L6_kg_VP0dAYvdcz1DWEWzy4NZPdlpHREod0uNK1E,3099
69
69
  uipath/models/llm_gateway.py,sha256=0sl5Wtve94V14H3AHwmJSoXAhoc-Fai3wJxP8HrnBPg,1994
70
70
  uipath/models/processes.py,sha256=Atvfrt6X4TYST3iA62jpS_Uxc3hg6uah11p-RaKZ6dk,2029
71
71
  uipath/models/queues.py,sha256=N_s0GKucbyjh0RnO8SxPk6wlRgvq8KIIYsfaoIY46tM,6446
72
- uipath-2.0.5.dist-info/METADATA,sha256=GWc1HQtzRxly86jzrRR7NtPq9M4qt0QYFchqLdzEkgo,6046
73
- uipath-2.0.5.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
74
- uipath-2.0.5.dist-info/entry_points.txt,sha256=9C2_29U6Oq1ExFu7usihR-dnfIVNSKc-0EFbh0rskB4,43
75
- uipath-2.0.5.dist-info/licenses/LICENSE,sha256=-KBavWXepyDjimmzH5fVAsi-6jNVpIKFc2kZs0Ri4ng,1058
76
- uipath-2.0.5.dist-info/RECORD,,
72
+ uipath-2.0.7.dist-info/METADATA,sha256=1PAzwQX2GIlHTyHOpF2gYCkaL55aF-p8v32ZTT_VsDA,6006
73
+ uipath-2.0.7.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
74
+ uipath-2.0.7.dist-info/entry_points.txt,sha256=9C2_29U6Oq1ExFu7usihR-dnfIVNSKc-0EFbh0rskB4,43
75
+ uipath-2.0.7.dist-info/licenses/LICENSE,sha256=-KBavWXepyDjimmzH5fVAsi-6jNVpIKFc2kZs0Ri4ng,1058
76
+ uipath-2.0.7.dist-info/RECORD,,
File without changes