uipath 2.0.54__py3-none-any.whl → 2.0.55__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/_auth_server.py +5 -16
- uipath/_cli/_auth/auth_config.json +2 -2
- uipath/_cli/cli_auth.py +2 -2
- uipath/_cli/cli_run.py +2 -2
- uipath/_services/__init__.py +2 -0
- uipath/_services/attachments_service.py +595 -0
- uipath/_services/jobs_service.py +255 -1
- uipath/_uipath.py +5 -0
- uipath/models/__init__.py +2 -0
- uipath/models/attachment.py +28 -0
- {uipath-2.0.54.dist-info → uipath-2.0.55.dist-info}/METADATA +1 -1
- {uipath-2.0.54.dist-info → uipath-2.0.55.dist-info}/RECORD +15 -13
- {uipath-2.0.54.dist-info → uipath-2.0.55.dist-info}/WHEEL +0 -0
- {uipath-2.0.54.dist-info → uipath-2.0.55.dist-info}/entry_points.txt +0 -0
- {uipath-2.0.54.dist-info → uipath-2.0.55.dist-info}/licenses/LICENSE +0 -0
|
@@ -2,7 +2,6 @@ import http.server
|
|
|
2
2
|
import json
|
|
3
3
|
import os
|
|
4
4
|
import socketserver
|
|
5
|
-
import ssl
|
|
6
5
|
import time
|
|
7
6
|
|
|
8
7
|
import click
|
|
@@ -109,19 +108,15 @@ def make_request_handler_class(state, code_verifier, token_callback, domain):
|
|
|
109
108
|
return SimpleHTTPSRequestHandler
|
|
110
109
|
|
|
111
110
|
|
|
112
|
-
class
|
|
113
|
-
def __init__(self, port=6234
|
|
114
|
-
"""Initialize
|
|
111
|
+
class HTTPServer:
|
|
112
|
+
def __init__(self, port=6234):
|
|
113
|
+
"""Initialize HTTP server with configurable parameters.
|
|
115
114
|
|
|
116
115
|
Args:
|
|
117
116
|
port (int, optional): Port number to run the server on. Defaults to 6234.
|
|
118
|
-
cert_file (str, optional): SSL certificate file. Defaults to "localhost.crt".
|
|
119
|
-
key_file (str, optional): SSL key file. Defaults to "localhost.key".
|
|
120
117
|
"""
|
|
121
118
|
self.current_path = os.path.dirname(os.path.abspath(__file__))
|
|
122
119
|
self.port = port
|
|
123
|
-
self.cert_file = os.path.join(self.current_path, "localhost.crt")
|
|
124
|
-
self.key_file = os.path.join(self.current_path, "localhost.key")
|
|
125
120
|
self.httpd = None
|
|
126
121
|
self.token_data = None
|
|
127
122
|
self.should_shutdown = False
|
|
@@ -136,7 +131,7 @@ class HTTPSServer:
|
|
|
136
131
|
self.should_shutdown = True
|
|
137
132
|
|
|
138
133
|
def create_server(self, state, code_verifier, domain):
|
|
139
|
-
"""Create and configure the
|
|
134
|
+
"""Create and configure the HTTP server.
|
|
140
135
|
|
|
141
136
|
Args:
|
|
142
137
|
state (str): The OAuth state parameter.
|
|
@@ -144,20 +139,14 @@ class HTTPSServer:
|
|
|
144
139
|
domain (str): The domain for authentication.
|
|
145
140
|
|
|
146
141
|
Returns:
|
|
147
|
-
socketserver.TCPServer: The configured
|
|
142
|
+
socketserver.TCPServer: The configured HTTP server.
|
|
148
143
|
"""
|
|
149
|
-
# Create SSL context
|
|
150
|
-
context = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER)
|
|
151
|
-
context.load_cert_chain(self.cert_file, self.key_file)
|
|
152
|
-
|
|
153
144
|
# Create server with address reuse
|
|
154
145
|
socketserver.TCPServer.allow_reuse_address = True
|
|
155
146
|
handler = make_request_handler_class(
|
|
156
147
|
state, code_verifier, self.token_received_callback, domain
|
|
157
148
|
)
|
|
158
149
|
self.httpd = socketserver.TCPServer(("", self.port), handler)
|
|
159
|
-
self.httpd.socket = context.wrap_socket(self.httpd.socket, server_side=True)
|
|
160
|
-
|
|
161
150
|
return self.httpd
|
|
162
151
|
|
|
163
152
|
def start(self, state, code_verifier, domain):
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"client_id": "36dea5b8-e8bb-423d-8e7b-c808df8f1c00",
|
|
3
|
-
"redirect_uri": "
|
|
3
|
+
"redirect_uri": "http://localhost:__PY_REPLACE_PORT__/oidc/login",
|
|
4
4
|
"scope": "offline_access OrchestratorApiUserAccess ConnectionService DataService DocumentUnderstanding EnterpriseContextService Directory JamJamApi LLMGateway LLMOps OMS RCS.FolderAuthorization",
|
|
5
5
|
"port": 8104
|
|
6
|
-
}
|
|
6
|
+
}
|
uipath/_cli/cli_auth.py
CHANGED
|
@@ -8,7 +8,7 @@ import click
|
|
|
8
8
|
from dotenv import load_dotenv
|
|
9
9
|
|
|
10
10
|
from ..telemetry import track
|
|
11
|
-
from ._auth._auth_server import
|
|
11
|
+
from ._auth._auth_server import HTTPServer
|
|
12
12
|
from ._auth._oidc_utils import get_auth_config, get_auth_url
|
|
13
13
|
from ._auth._portal_service import PortalService, select_tenant
|
|
14
14
|
from ._auth._utils import update_auth_file, update_env_file
|
|
@@ -97,7 +97,7 @@ def auth(domain, force: None | bool = False):
|
|
|
97
97
|
auth_url,
|
|
98
98
|
)
|
|
99
99
|
|
|
100
|
-
server =
|
|
100
|
+
server = HTTPServer(port=auth_config["port"])
|
|
101
101
|
token_data = server.start(state, code_verifier, domain)
|
|
102
102
|
|
|
103
103
|
if token_data:
|
uipath/_cli/cli_run.py
CHANGED
|
@@ -42,14 +42,14 @@ def python_run_middleware(
|
|
|
42
42
|
if not entrypoint:
|
|
43
43
|
return MiddlewareResult(
|
|
44
44
|
should_continue=False,
|
|
45
|
-
|
|
45
|
+
error_message="""No entrypoint specified. Please provide a path to a Python script.
|
|
46
46
|
Usage: `uipath run <entrypoint_path> <input_arguments> [-f <input_json_file_path>]`""",
|
|
47
47
|
)
|
|
48
48
|
|
|
49
49
|
if not os.path.exists(entrypoint):
|
|
50
50
|
return MiddlewareResult(
|
|
51
51
|
should_continue=False,
|
|
52
|
-
error_message=f"""
|
|
52
|
+
error_message=f"""Script not found at path {entrypoint}.
|
|
53
53
|
Usage: `uipath run <entrypoint_path> <input_arguments> [-f <input_json_file_path>]`""",
|
|
54
54
|
)
|
|
55
55
|
|
uipath/_services/__init__.py
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
from .actions_service import ActionsService
|
|
2
2
|
from .api_client import ApiClient
|
|
3
3
|
from .assets_service import AssetsService
|
|
4
|
+
from .attachments_service import AttachmentsService
|
|
4
5
|
from .buckets_service import BucketsService
|
|
5
6
|
from .connections_service import ConnectionsService
|
|
6
7
|
from .context_grounding_service import ContextGroundingService
|
|
@@ -13,6 +14,7 @@ from .queues_service import QueuesService
|
|
|
13
14
|
__all__ = [
|
|
14
15
|
"ActionsService",
|
|
15
16
|
"AssetsService",
|
|
17
|
+
"AttachmentsService",
|
|
16
18
|
"BucketsService",
|
|
17
19
|
"ConnectionsService",
|
|
18
20
|
"ContextGroundingService",
|
|
@@ -0,0 +1,595 @@
|
|
|
1
|
+
import uuid
|
|
2
|
+
from typing import Any, Dict, Optional, Union, overload
|
|
3
|
+
|
|
4
|
+
from httpx import request
|
|
5
|
+
|
|
6
|
+
from .._config import Config
|
|
7
|
+
from .._execution_context import ExecutionContext
|
|
8
|
+
from .._folder_context import FolderContext
|
|
9
|
+
from .._utils import Endpoint, RequestSpec, header_folder
|
|
10
|
+
from ..tracing._traced import traced
|
|
11
|
+
from ._base_service import BaseService
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def _upload_attachment_input_processor(inputs: Dict[str, Any]) -> Dict[str, Any]:
|
|
15
|
+
"""Process attachment upload inputs to avoid logging large content."""
|
|
16
|
+
processed_inputs = inputs.copy()
|
|
17
|
+
if "source_path" in processed_inputs:
|
|
18
|
+
processed_inputs["source_path"] = f"<File at {processed_inputs['source_path']}>"
|
|
19
|
+
if "content" in processed_inputs:
|
|
20
|
+
if isinstance(processed_inputs["content"], str):
|
|
21
|
+
processed_inputs["content"] = "<Redacted String Content>"
|
|
22
|
+
else:
|
|
23
|
+
processed_inputs["content"] = "<Redacted Binary Content>"
|
|
24
|
+
return processed_inputs
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
class AttachmentsService(FolderContext, BaseService):
|
|
28
|
+
"""Service for managing UiPath attachments.
|
|
29
|
+
|
|
30
|
+
Attachments allow you to upload and download files to be used within UiPath
|
|
31
|
+
processes, actions, and other UiPath services.
|
|
32
|
+
|
|
33
|
+
Reference: https://docs.uipath.com/orchestrator/reference/api-attachments
|
|
34
|
+
"""
|
|
35
|
+
|
|
36
|
+
def __init__(self, config: Config, execution_context: ExecutionContext) -> None:
|
|
37
|
+
super().__init__(config=config, execution_context=execution_context)
|
|
38
|
+
|
|
39
|
+
@traced(name="attachments_download", run_type="uipath")
|
|
40
|
+
def download(
|
|
41
|
+
self,
|
|
42
|
+
*,
|
|
43
|
+
key: uuid.UUID,
|
|
44
|
+
destination_path: str,
|
|
45
|
+
folder_key: Optional[str] = None,
|
|
46
|
+
folder_path: Optional[str] = None,
|
|
47
|
+
) -> str:
|
|
48
|
+
"""Download an attachment.
|
|
49
|
+
|
|
50
|
+
This method downloads an attachment from UiPath to a local file.
|
|
51
|
+
|
|
52
|
+
Args:
|
|
53
|
+
key (uuid.UUID): The key of the attachment to download.
|
|
54
|
+
destination_path (str): The local path where the attachment will be saved.
|
|
55
|
+
folder_key (Optional[str]): The key of the folder. Override the default one set in the SDK config.
|
|
56
|
+
folder_path (Optional[str]): The path of the folder. Override the default one set in the SDK config.
|
|
57
|
+
|
|
58
|
+
Returns:
|
|
59
|
+
str: The name of the downloaded attachment.
|
|
60
|
+
|
|
61
|
+
Raises:
|
|
62
|
+
Exception: If the download fails.
|
|
63
|
+
|
|
64
|
+
Examples:
|
|
65
|
+
```python
|
|
66
|
+
from uipath import UiPath
|
|
67
|
+
|
|
68
|
+
client = UiPath()
|
|
69
|
+
|
|
70
|
+
attachment_name = client.attachments.download(
|
|
71
|
+
key=uuid.UUID("123e4567-e89b-12d3-a456-426614174000"),
|
|
72
|
+
destination_path="path/to/save/document.pdf"
|
|
73
|
+
)
|
|
74
|
+
print(f"Downloaded attachment: {attachment_name}")
|
|
75
|
+
```
|
|
76
|
+
"""
|
|
77
|
+
spec = self._retrieve_download_uri_spec(
|
|
78
|
+
key=key,
|
|
79
|
+
folder_key=folder_key,
|
|
80
|
+
folder_path=folder_path,
|
|
81
|
+
)
|
|
82
|
+
|
|
83
|
+
result = self.request(
|
|
84
|
+
spec.method,
|
|
85
|
+
url=spec.endpoint,
|
|
86
|
+
params=spec.params,
|
|
87
|
+
headers=spec.headers,
|
|
88
|
+
).json()
|
|
89
|
+
|
|
90
|
+
# Get the attachment name
|
|
91
|
+
attachment_name = result["Name"]
|
|
92
|
+
|
|
93
|
+
download_uri = result["BlobFileAccess"]["Uri"]
|
|
94
|
+
headers = {
|
|
95
|
+
key: value
|
|
96
|
+
for key, value in zip(
|
|
97
|
+
result["BlobFileAccess"]["Headers"]["Keys"],
|
|
98
|
+
result["BlobFileAccess"]["Headers"]["Values"],
|
|
99
|
+
strict=False,
|
|
100
|
+
)
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
with open(destination_path, "wb") as file:
|
|
104
|
+
if result["BlobFileAccess"]["RequiresAuth"]:
|
|
105
|
+
file_content = self.request(
|
|
106
|
+
"GET", download_uri, headers=headers
|
|
107
|
+
).content
|
|
108
|
+
else:
|
|
109
|
+
file_content = request("GET", download_uri, headers=headers).content
|
|
110
|
+
file.write(file_content)
|
|
111
|
+
|
|
112
|
+
return attachment_name
|
|
113
|
+
|
|
114
|
+
@traced(name="attachments_download", run_type="uipath")
|
|
115
|
+
async def download_async(
|
|
116
|
+
self,
|
|
117
|
+
*,
|
|
118
|
+
key: uuid.UUID,
|
|
119
|
+
destination_path: str,
|
|
120
|
+
folder_key: Optional[str] = None,
|
|
121
|
+
folder_path: Optional[str] = None,
|
|
122
|
+
) -> str:
|
|
123
|
+
"""Download an attachment asynchronously.
|
|
124
|
+
|
|
125
|
+
This method asynchronously downloads an attachment from UiPath to a local file.
|
|
126
|
+
|
|
127
|
+
Args:
|
|
128
|
+
key (uuid.UUID): The key of the attachment to download.
|
|
129
|
+
destination_path (str): The local path where the attachment will be saved.
|
|
130
|
+
folder_key (Optional[str]): The key of the folder. Override the default one set in the SDK config.
|
|
131
|
+
folder_path (Optional[str]): The path of the folder. Override the default one set in the SDK config.
|
|
132
|
+
|
|
133
|
+
Returns:
|
|
134
|
+
str: The name of the downloaded attachment.
|
|
135
|
+
|
|
136
|
+
Raises:
|
|
137
|
+
Exception: If the download fails.
|
|
138
|
+
|
|
139
|
+
Examples:
|
|
140
|
+
```python
|
|
141
|
+
import asyncio
|
|
142
|
+
from uipath import UiPath
|
|
143
|
+
|
|
144
|
+
client = UiPath()
|
|
145
|
+
|
|
146
|
+
async def main():
|
|
147
|
+
attachment_name = await client.attachments.download_async(
|
|
148
|
+
key=uuid.UUID("123e4567-e89b-12d3-a456-426614174000"),
|
|
149
|
+
destination_path="path/to/save/document.pdf"
|
|
150
|
+
)
|
|
151
|
+
print(f"Downloaded attachment: {attachment_name}")
|
|
152
|
+
```
|
|
153
|
+
"""
|
|
154
|
+
spec = self._retrieve_download_uri_spec(
|
|
155
|
+
key=key,
|
|
156
|
+
folder_key=folder_key,
|
|
157
|
+
folder_path=folder_path,
|
|
158
|
+
)
|
|
159
|
+
|
|
160
|
+
result = (
|
|
161
|
+
await self.request_async(
|
|
162
|
+
spec.method,
|
|
163
|
+
url=spec.endpoint,
|
|
164
|
+
params=spec.params,
|
|
165
|
+
headers=spec.headers,
|
|
166
|
+
)
|
|
167
|
+
).json()
|
|
168
|
+
|
|
169
|
+
# Get the attachment name
|
|
170
|
+
attachment_name = result["Name"]
|
|
171
|
+
|
|
172
|
+
download_uri = result["BlobFileAccess"]["Uri"]
|
|
173
|
+
headers = {
|
|
174
|
+
key: value
|
|
175
|
+
for key, value in zip(
|
|
176
|
+
result["BlobFileAccess"]["Headers"]["Keys"],
|
|
177
|
+
result["BlobFileAccess"]["Headers"]["Values"],
|
|
178
|
+
strict=False,
|
|
179
|
+
)
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
with open(destination_path, "wb") as file:
|
|
183
|
+
if result["BlobFileAccess"]["RequiresAuth"]:
|
|
184
|
+
response = await self.request_async(
|
|
185
|
+
"GET", download_uri, headers=headers
|
|
186
|
+
)
|
|
187
|
+
file.write(response.content)
|
|
188
|
+
else:
|
|
189
|
+
file.write(request("GET", download_uri, headers=headers).content)
|
|
190
|
+
|
|
191
|
+
return attachment_name
|
|
192
|
+
|
|
193
|
+
@overload
|
|
194
|
+
def upload(
|
|
195
|
+
self,
|
|
196
|
+
*,
|
|
197
|
+
name: str,
|
|
198
|
+
content: Union[str, bytes],
|
|
199
|
+
folder_key: Optional[str] = None,
|
|
200
|
+
folder_path: Optional[str] = None,
|
|
201
|
+
) -> uuid.UUID: ...
|
|
202
|
+
|
|
203
|
+
@overload
|
|
204
|
+
def upload(
|
|
205
|
+
self,
|
|
206
|
+
*,
|
|
207
|
+
name: str,
|
|
208
|
+
source_path: str,
|
|
209
|
+
folder_key: Optional[str] = None,
|
|
210
|
+
folder_path: Optional[str] = None,
|
|
211
|
+
) -> uuid.UUID: ...
|
|
212
|
+
|
|
213
|
+
@traced(
|
|
214
|
+
name="attachments_upload",
|
|
215
|
+
run_type="uipath",
|
|
216
|
+
input_processor=_upload_attachment_input_processor,
|
|
217
|
+
)
|
|
218
|
+
def upload(
|
|
219
|
+
self,
|
|
220
|
+
*,
|
|
221
|
+
name: str,
|
|
222
|
+
content: Optional[Union[str, bytes]] = None,
|
|
223
|
+
source_path: Optional[str] = None,
|
|
224
|
+
folder_key: Optional[str] = None,
|
|
225
|
+
folder_path: Optional[str] = None,
|
|
226
|
+
) -> uuid.UUID:
|
|
227
|
+
"""Upload a file or content to UiPath as an attachment.
|
|
228
|
+
|
|
229
|
+
This method uploads content to UiPath and makes it available as an attachment.
|
|
230
|
+
You can either provide a file path or content in memory.
|
|
231
|
+
|
|
232
|
+
Args:
|
|
233
|
+
name (str): The name of the attachment file.
|
|
234
|
+
content (Optional[Union[str, bytes]]): The content to upload (string or bytes).
|
|
235
|
+
source_path (Optional[str]): The local path of the file to upload.
|
|
236
|
+
folder_key (Optional[str]): The key of the folder. Override the default one set in the SDK config.
|
|
237
|
+
folder_path (Optional[str]): The path of the folder. Override the default one set in the SDK config.
|
|
238
|
+
|
|
239
|
+
Returns:
|
|
240
|
+
uuid.UUID: The UUID of the created attachment.
|
|
241
|
+
|
|
242
|
+
Raises:
|
|
243
|
+
ValueError: If neither content nor source_path is provided, or if both are provided.
|
|
244
|
+
Exception: If the upload fails.
|
|
245
|
+
|
|
246
|
+
Examples:
|
|
247
|
+
```python
|
|
248
|
+
from uipath import UiPath
|
|
249
|
+
|
|
250
|
+
client = UiPath()
|
|
251
|
+
|
|
252
|
+
# Upload a file from disk
|
|
253
|
+
attachment_key = client.attachments.upload(
|
|
254
|
+
name="my-document.pdf",
|
|
255
|
+
source_path="path/to/local/document.pdf",
|
|
256
|
+
)
|
|
257
|
+
print(f"Uploaded attachment with key: {attachment_key}")
|
|
258
|
+
|
|
259
|
+
# Upload content from memory
|
|
260
|
+
attachment_key = client.attachments.upload(
|
|
261
|
+
name="notes.txt",
|
|
262
|
+
content="This is a text file content",
|
|
263
|
+
)
|
|
264
|
+
print(f"Uploaded attachment with key: {attachment_key}")
|
|
265
|
+
```
|
|
266
|
+
"""
|
|
267
|
+
# Validate input parameters
|
|
268
|
+
if not (content or source_path):
|
|
269
|
+
raise ValueError("Content or source_path is required")
|
|
270
|
+
if content and source_path:
|
|
271
|
+
raise ValueError("Content and source_path are mutually exclusive")
|
|
272
|
+
|
|
273
|
+
spec = self._create_attachment_and_retrieve_upload_uri_spec(
|
|
274
|
+
name=name,
|
|
275
|
+
folder_key=folder_key,
|
|
276
|
+
folder_path=folder_path,
|
|
277
|
+
)
|
|
278
|
+
|
|
279
|
+
result = self.request(
|
|
280
|
+
spec.method,
|
|
281
|
+
url=spec.endpoint,
|
|
282
|
+
params=spec.params,
|
|
283
|
+
headers=spec.headers,
|
|
284
|
+
json=spec.json,
|
|
285
|
+
).json()
|
|
286
|
+
|
|
287
|
+
# Get the ID from the response and convert to UUID
|
|
288
|
+
attachment_key = uuid.UUID(result["Id"])
|
|
289
|
+
|
|
290
|
+
upload_uri = result["BlobFileAccess"]["Uri"]
|
|
291
|
+
headers = {
|
|
292
|
+
key: value
|
|
293
|
+
for key, value in zip(
|
|
294
|
+
result["BlobFileAccess"]["Headers"]["Keys"],
|
|
295
|
+
result["BlobFileAccess"]["Headers"]["Values"],
|
|
296
|
+
strict=False,
|
|
297
|
+
)
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
if source_path:
|
|
301
|
+
# Upload from file
|
|
302
|
+
with open(source_path, "rb") as file:
|
|
303
|
+
if result["BlobFileAccess"]["RequiresAuth"]:
|
|
304
|
+
self.request(
|
|
305
|
+
"PUT", upload_uri, headers=headers, files={"file": file}
|
|
306
|
+
)
|
|
307
|
+
else:
|
|
308
|
+
request("PUT", upload_uri, headers=headers, files={"file": file})
|
|
309
|
+
else:
|
|
310
|
+
# Upload from memory
|
|
311
|
+
# Convert string to bytes if needed
|
|
312
|
+
if isinstance(content, str):
|
|
313
|
+
content = content.encode("utf-8")
|
|
314
|
+
|
|
315
|
+
if result["BlobFileAccess"]["RequiresAuth"]:
|
|
316
|
+
self.request("PUT", upload_uri, headers=headers, content=content)
|
|
317
|
+
else:
|
|
318
|
+
request("PUT", upload_uri, headers=headers, content=content)
|
|
319
|
+
|
|
320
|
+
return attachment_key
|
|
321
|
+
|
|
322
|
+
@overload
|
|
323
|
+
async def upload_async(
|
|
324
|
+
self,
|
|
325
|
+
*,
|
|
326
|
+
name: str,
|
|
327
|
+
content: Union[str, bytes],
|
|
328
|
+
folder_key: Optional[str] = None,
|
|
329
|
+
folder_path: Optional[str] = None,
|
|
330
|
+
) -> uuid.UUID: ...
|
|
331
|
+
|
|
332
|
+
@overload
|
|
333
|
+
async def upload_async(
|
|
334
|
+
self,
|
|
335
|
+
*,
|
|
336
|
+
name: str,
|
|
337
|
+
source_path: str,
|
|
338
|
+
folder_key: Optional[str] = None,
|
|
339
|
+
folder_path: Optional[str] = None,
|
|
340
|
+
) -> uuid.UUID: ...
|
|
341
|
+
|
|
342
|
+
@traced(
|
|
343
|
+
name="attachments_upload",
|
|
344
|
+
run_type="uipath",
|
|
345
|
+
input_processor=_upload_attachment_input_processor,
|
|
346
|
+
)
|
|
347
|
+
async def upload_async(
|
|
348
|
+
self,
|
|
349
|
+
*,
|
|
350
|
+
name: str,
|
|
351
|
+
content: Optional[Union[str, bytes]] = None,
|
|
352
|
+
source_path: Optional[str] = None,
|
|
353
|
+
folder_key: Optional[str] = None,
|
|
354
|
+
folder_path: Optional[str] = None,
|
|
355
|
+
) -> uuid.UUID:
|
|
356
|
+
"""Upload a file or content to UiPath as an attachment asynchronously.
|
|
357
|
+
|
|
358
|
+
This method asynchronously uploads content to UiPath and makes it available as an attachment.
|
|
359
|
+
You can either provide a file path or content in memory.
|
|
360
|
+
|
|
361
|
+
Args:
|
|
362
|
+
name (str): The name of the attachment file.
|
|
363
|
+
content (Optional[Union[str, bytes]]): The content to upload (string or bytes).
|
|
364
|
+
source_path (Optional[str]): The local path of the file to upload.
|
|
365
|
+
folder_key (Optional[str]): The key of the folder. Override the default one set in the SDK config.
|
|
366
|
+
folder_path (Optional[str]): The path of the folder. Override the default one set in the SDK config.
|
|
367
|
+
|
|
368
|
+
Returns:
|
|
369
|
+
uuid.UUID: The UUID of the created attachment.
|
|
370
|
+
|
|
371
|
+
Raises:
|
|
372
|
+
ValueError: If neither content nor source_path is provided, or if both are provided.
|
|
373
|
+
Exception: If the upload fails.
|
|
374
|
+
|
|
375
|
+
Examples:
|
|
376
|
+
```python
|
|
377
|
+
import asyncio
|
|
378
|
+
from uipath import UiPath
|
|
379
|
+
|
|
380
|
+
client = UiPath()
|
|
381
|
+
|
|
382
|
+
async def main():
|
|
383
|
+
# Upload a file from disk
|
|
384
|
+
attachment_key = await client.attachments.upload_async(
|
|
385
|
+
name="my-document.pdf",
|
|
386
|
+
source_path="path/to/local/document.pdf",
|
|
387
|
+
)
|
|
388
|
+
print(f"Uploaded attachment with key: {attachment_key}")
|
|
389
|
+
|
|
390
|
+
# Upload content from memory
|
|
391
|
+
attachment_key = await client.attachments.upload_async(
|
|
392
|
+
name="notes.txt",
|
|
393
|
+
content="This is a text file content",
|
|
394
|
+
)
|
|
395
|
+
print(f"Uploaded attachment with key: {attachment_key}")
|
|
396
|
+
```
|
|
397
|
+
"""
|
|
398
|
+
# Validate input parameters
|
|
399
|
+
if not (content or source_path):
|
|
400
|
+
raise ValueError("Content or source_path is required")
|
|
401
|
+
if content and source_path:
|
|
402
|
+
raise ValueError("Content and source_path are mutually exclusive")
|
|
403
|
+
|
|
404
|
+
spec = self._create_attachment_and_retrieve_upload_uri_spec(
|
|
405
|
+
name=name,
|
|
406
|
+
folder_key=folder_key,
|
|
407
|
+
folder_path=folder_path,
|
|
408
|
+
)
|
|
409
|
+
|
|
410
|
+
result = (
|
|
411
|
+
await self.request_async(
|
|
412
|
+
spec.method,
|
|
413
|
+
url=spec.endpoint,
|
|
414
|
+
params=spec.params,
|
|
415
|
+
headers=spec.headers,
|
|
416
|
+
json=spec.json,
|
|
417
|
+
)
|
|
418
|
+
).json()
|
|
419
|
+
|
|
420
|
+
# Get the ID from the response and convert to UUID
|
|
421
|
+
attachment_key = uuid.UUID(result["Id"])
|
|
422
|
+
|
|
423
|
+
upload_uri = result["BlobFileAccess"]["Uri"]
|
|
424
|
+
headers = {
|
|
425
|
+
key: value
|
|
426
|
+
for key, value in zip(
|
|
427
|
+
result["BlobFileAccess"]["Headers"]["Keys"],
|
|
428
|
+
result["BlobFileAccess"]["Headers"]["Values"],
|
|
429
|
+
strict=False,
|
|
430
|
+
)
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
if source_path:
|
|
434
|
+
# Upload from file
|
|
435
|
+
with open(source_path, "rb") as file:
|
|
436
|
+
if result["BlobFileAccess"]["RequiresAuth"]:
|
|
437
|
+
await self.request_async(
|
|
438
|
+
"PUT", upload_uri, headers=headers, files={"file": file}
|
|
439
|
+
)
|
|
440
|
+
else:
|
|
441
|
+
request("PUT", upload_uri, headers=headers, files={"file": file})
|
|
442
|
+
else:
|
|
443
|
+
# Upload from memory
|
|
444
|
+
# Convert string to bytes if needed
|
|
445
|
+
if isinstance(content, str):
|
|
446
|
+
content = content.encode("utf-8")
|
|
447
|
+
|
|
448
|
+
if result["BlobFileAccess"]["RequiresAuth"]:
|
|
449
|
+
await self.request_async(
|
|
450
|
+
"PUT", upload_uri, headers=headers, content=content
|
|
451
|
+
)
|
|
452
|
+
else:
|
|
453
|
+
request("PUT", upload_uri, headers=headers, content=content)
|
|
454
|
+
|
|
455
|
+
return attachment_key
|
|
456
|
+
|
|
457
|
+
@traced(name="attachments_delete", run_type="uipath")
|
|
458
|
+
def delete(
|
|
459
|
+
self,
|
|
460
|
+
*,
|
|
461
|
+
key: uuid.UUID,
|
|
462
|
+
folder_key: Optional[str] = None,
|
|
463
|
+
folder_path: Optional[str] = None,
|
|
464
|
+
) -> None:
|
|
465
|
+
"""Delete an attachment.
|
|
466
|
+
|
|
467
|
+
This method deletes an attachment from UiPath.
|
|
468
|
+
|
|
469
|
+
Args:
|
|
470
|
+
key (uuid.UUID): The key of the attachment to delete.
|
|
471
|
+
folder_key (Optional[str]): The key of the folder. Override the default one set in the SDK config.
|
|
472
|
+
folder_path (Optional[str]): The path of the folder. Override the default one set in the SDK config.
|
|
473
|
+
|
|
474
|
+
Raises:
|
|
475
|
+
Exception: If the deletion fails.
|
|
476
|
+
|
|
477
|
+
Examples:
|
|
478
|
+
```python
|
|
479
|
+
from uipath import UiPath
|
|
480
|
+
|
|
481
|
+
client = UiPath()
|
|
482
|
+
|
|
483
|
+
client.attachments.delete(
|
|
484
|
+
key=uuid.UUID("123e4567-e89b-12d3-a456-426614174000")
|
|
485
|
+
)
|
|
486
|
+
print("Attachment deleted successfully")
|
|
487
|
+
```
|
|
488
|
+
"""
|
|
489
|
+
spec = self._delete_attachment_spec(
|
|
490
|
+
key=key,
|
|
491
|
+
folder_key=folder_key,
|
|
492
|
+
folder_path=folder_path,
|
|
493
|
+
)
|
|
494
|
+
|
|
495
|
+
self.request(
|
|
496
|
+
spec.method,
|
|
497
|
+
url=spec.endpoint,
|
|
498
|
+
headers=spec.headers,
|
|
499
|
+
)
|
|
500
|
+
|
|
501
|
+
@traced(name="attachments_delete", run_type="uipath")
|
|
502
|
+
async def delete_async(
|
|
503
|
+
self,
|
|
504
|
+
*,
|
|
505
|
+
key: uuid.UUID,
|
|
506
|
+
folder_key: Optional[str] = None,
|
|
507
|
+
folder_path: Optional[str] = None,
|
|
508
|
+
) -> None:
|
|
509
|
+
"""Delete an attachment asynchronously.
|
|
510
|
+
|
|
511
|
+
This method asynchronously deletes an attachment from UiPath.
|
|
512
|
+
|
|
513
|
+
Args:
|
|
514
|
+
key (uuid.UUID): The key of the attachment to delete.
|
|
515
|
+
folder_key (Optional[str]): The key of the folder. Override the default one set in the SDK config.
|
|
516
|
+
folder_path (Optional[str]): The path of the folder. Override the default one set in the SDK config.
|
|
517
|
+
|
|
518
|
+
Raises:
|
|
519
|
+
Exception: If the deletion fails.
|
|
520
|
+
|
|
521
|
+
Examples:
|
|
522
|
+
```python
|
|
523
|
+
import asyncio
|
|
524
|
+
from uipath import UiPath
|
|
525
|
+
|
|
526
|
+
client = UiPath()
|
|
527
|
+
|
|
528
|
+
async def main():
|
|
529
|
+
await client.attachments.delete_async(
|
|
530
|
+
key=uuid.UUID("123e4567-e89b-12d3-a456-426614174000")
|
|
531
|
+
)
|
|
532
|
+
print("Attachment deleted successfully")
|
|
533
|
+
```
|
|
534
|
+
"""
|
|
535
|
+
spec = self._delete_attachment_spec(
|
|
536
|
+
key=key,
|
|
537
|
+
folder_key=folder_key,
|
|
538
|
+
folder_path=folder_path,
|
|
539
|
+
)
|
|
540
|
+
|
|
541
|
+
await self.request_async(
|
|
542
|
+
spec.method,
|
|
543
|
+
url=spec.endpoint,
|
|
544
|
+
headers=spec.headers,
|
|
545
|
+
)
|
|
546
|
+
|
|
547
|
+
@property
|
|
548
|
+
def custom_headers(self) -> Dict[str, str]:
|
|
549
|
+
"""Return custom headers for API requests."""
|
|
550
|
+
return self.folder_headers
|
|
551
|
+
|
|
552
|
+
def _create_attachment_and_retrieve_upload_uri_spec(
|
|
553
|
+
self,
|
|
554
|
+
name: str,
|
|
555
|
+
folder_key: Optional[str] = None,
|
|
556
|
+
folder_path: Optional[str] = None,
|
|
557
|
+
) -> RequestSpec:
|
|
558
|
+
return RequestSpec(
|
|
559
|
+
method="POST",
|
|
560
|
+
endpoint=Endpoint("/orchestrator_/odata/Attachments"),
|
|
561
|
+
json={
|
|
562
|
+
"Name": name,
|
|
563
|
+
},
|
|
564
|
+
headers={
|
|
565
|
+
**header_folder(folder_key, folder_path),
|
|
566
|
+
},
|
|
567
|
+
)
|
|
568
|
+
|
|
569
|
+
def _retrieve_download_uri_spec(
|
|
570
|
+
self,
|
|
571
|
+
key: uuid.UUID,
|
|
572
|
+
folder_key: Optional[str] = None,
|
|
573
|
+
folder_path: Optional[str] = None,
|
|
574
|
+
) -> RequestSpec:
|
|
575
|
+
return RequestSpec(
|
|
576
|
+
method="GET",
|
|
577
|
+
endpoint=Endpoint(f"/orchestrator_/odata/Attachments({key})"),
|
|
578
|
+
headers={
|
|
579
|
+
**header_folder(folder_key, folder_path),
|
|
580
|
+
},
|
|
581
|
+
)
|
|
582
|
+
|
|
583
|
+
def _delete_attachment_spec(
|
|
584
|
+
self,
|
|
585
|
+
key: uuid.UUID,
|
|
586
|
+
folder_key: Optional[str] = None,
|
|
587
|
+
folder_path: Optional[str] = None,
|
|
588
|
+
) -> RequestSpec:
|
|
589
|
+
return RequestSpec(
|
|
590
|
+
method="DELETE",
|
|
591
|
+
endpoint=Endpoint(f"/orchestrator_/odata/Attachments({key})"),
|
|
592
|
+
headers={
|
|
593
|
+
**header_folder(folder_key, folder_path),
|
|
594
|
+
},
|
|
595
|
+
)
|
uipath/_services/jobs_service.py
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import json
|
|
2
|
-
|
|
2
|
+
import uuid
|
|
3
|
+
from typing import Any, Dict, List, Optional, overload
|
|
3
4
|
|
|
4
5
|
from .._config import Config
|
|
5
6
|
from .._execution_context import ExecutionContext
|
|
6
7
|
from .._folder_context import FolderContext
|
|
7
8
|
from .._utils import Endpoint, RequestSpec, header_folder
|
|
9
|
+
from ..models import Attachment
|
|
8
10
|
from ..models.job import Job
|
|
9
11
|
from ..tracing._traced import traced
|
|
10
12
|
from ._base_service import BaseService
|
|
@@ -265,3 +267,255 @@ class JobsService(FolderContext, BaseService):
|
|
|
265
267
|
f"/orchestrator_/odata/Jobs/UiPath.Server.Configuration.OData.GetByKey(identifier={job_key})"
|
|
266
268
|
),
|
|
267
269
|
)
|
|
270
|
+
|
|
271
|
+
@traced(name="jobs_list_attachments", run_type="uipath")
|
|
272
|
+
def list_attachments(
|
|
273
|
+
self,
|
|
274
|
+
*,
|
|
275
|
+
job_key: uuid.UUID,
|
|
276
|
+
folder_key: Optional[str] = None,
|
|
277
|
+
folder_path: Optional[str] = None,
|
|
278
|
+
) -> List[Attachment]:
|
|
279
|
+
"""List attachments associated with a specific job.
|
|
280
|
+
|
|
281
|
+
This method retrieves all attachments linked to a job by its key.
|
|
282
|
+
|
|
283
|
+
Args:
|
|
284
|
+
job_key (uuid.UUID): The key of the job to retrieve attachments for.
|
|
285
|
+
folder_key (Optional[str]): The key of the folder. Override the default one set in the SDK config.
|
|
286
|
+
folder_path (Optional[str]): The path of the folder. Override the default one set in the SDK config.
|
|
287
|
+
|
|
288
|
+
Returns:
|
|
289
|
+
List[Attachment]: A list of attachment objects associated with the job.
|
|
290
|
+
|
|
291
|
+
Raises:
|
|
292
|
+
Exception: If the retrieval fails.
|
|
293
|
+
|
|
294
|
+
Examples:
|
|
295
|
+
```python
|
|
296
|
+
from uipath import UiPath
|
|
297
|
+
|
|
298
|
+
client = UiPath()
|
|
299
|
+
|
|
300
|
+
attachments = client.jobs.list_attachments(
|
|
301
|
+
job_key=uuid.UUID("123e4567-e89b-12d3-a456-426614174000")
|
|
302
|
+
)
|
|
303
|
+
for attachment in attachments:
|
|
304
|
+
print(f"Attachment: {attachment.Name}, Key: {attachment.Key}")
|
|
305
|
+
```
|
|
306
|
+
"""
|
|
307
|
+
spec = self._list_job_attachments_spec(
|
|
308
|
+
job_key=job_key,
|
|
309
|
+
folder_key=folder_key,
|
|
310
|
+
folder_path=folder_path,
|
|
311
|
+
)
|
|
312
|
+
|
|
313
|
+
response = self.request(
|
|
314
|
+
spec.method,
|
|
315
|
+
url=spec.endpoint,
|
|
316
|
+
params=spec.params,
|
|
317
|
+
headers=spec.headers,
|
|
318
|
+
).json()
|
|
319
|
+
|
|
320
|
+
return [Attachment.model_validate(item) for item in response]
|
|
321
|
+
|
|
322
|
+
@traced(name="jobs_list_attachments", run_type="uipath")
|
|
323
|
+
async def list_attachments_async(
|
|
324
|
+
self,
|
|
325
|
+
*,
|
|
326
|
+
job_key: uuid.UUID,
|
|
327
|
+
folder_key: Optional[str] = None,
|
|
328
|
+
folder_path: Optional[str] = None,
|
|
329
|
+
) -> List[Attachment]:
|
|
330
|
+
"""List attachments associated with a specific job asynchronously.
|
|
331
|
+
|
|
332
|
+
This method asynchronously retrieves all attachments linked to a job by its key.
|
|
333
|
+
|
|
334
|
+
Args:
|
|
335
|
+
job_key (uuid.UUID): The key of the job to retrieve attachments for.
|
|
336
|
+
folder_key (Optional[str]): The key of the folder. Override the default one set in the SDK config.
|
|
337
|
+
folder_path (Optional[str]): The path of the folder. Override the default one set in the SDK config.
|
|
338
|
+
|
|
339
|
+
Returns:
|
|
340
|
+
List[Attachment]: A list of attachment objects associated with the job.
|
|
341
|
+
|
|
342
|
+
Raises:
|
|
343
|
+
Exception: If the retrieval fails.
|
|
344
|
+
|
|
345
|
+
Examples:
|
|
346
|
+
```python
|
|
347
|
+
import asyncio
|
|
348
|
+
from uipath import UiPath
|
|
349
|
+
|
|
350
|
+
client = UiPath()
|
|
351
|
+
|
|
352
|
+
async def main():
|
|
353
|
+
attachments = await client.jobs.list_attachments_async(
|
|
354
|
+
job_key=uuid.UUID("123e4567-e89b-12d3-a456-426614174000")
|
|
355
|
+
)
|
|
356
|
+
for attachment in attachments:
|
|
357
|
+
print(f"Attachment: {attachment.Name}, Key: {attachment.Key}")
|
|
358
|
+
```
|
|
359
|
+
"""
|
|
360
|
+
spec = self._list_job_attachments_spec(
|
|
361
|
+
job_key=job_key,
|
|
362
|
+
folder_key=folder_key,
|
|
363
|
+
folder_path=folder_path,
|
|
364
|
+
)
|
|
365
|
+
|
|
366
|
+
response = (
|
|
367
|
+
await self.request_async(
|
|
368
|
+
spec.method,
|
|
369
|
+
url=spec.endpoint,
|
|
370
|
+
params=spec.params,
|
|
371
|
+
headers=spec.headers,
|
|
372
|
+
)
|
|
373
|
+
).json()
|
|
374
|
+
|
|
375
|
+
return [Attachment.model_validate(item) for item in response]
|
|
376
|
+
|
|
377
|
+
@traced(name="jobs_link_attachment", run_type="uipath")
|
|
378
|
+
def link_attachment(
|
|
379
|
+
self,
|
|
380
|
+
*,
|
|
381
|
+
attachment_key: uuid.UUID,
|
|
382
|
+
job_key: uuid.UUID,
|
|
383
|
+
category: Optional[str] = None,
|
|
384
|
+
folder_key: Optional[str] = None,
|
|
385
|
+
folder_path: Optional[str] = None,
|
|
386
|
+
):
|
|
387
|
+
"""Link an attachment to a job.
|
|
388
|
+
|
|
389
|
+
This method links an existing attachment to a specific job.
|
|
390
|
+
|
|
391
|
+
Args:
|
|
392
|
+
attachment_key (uuid.UUID): The key of the attachment to link.
|
|
393
|
+
job_key (uuid.UUID): The key of the job to link the attachment to.
|
|
394
|
+
category (Optional[str]): Optional category for the attachment in the context of this job.
|
|
395
|
+
folder_key (Optional[str]): The key of the folder. Override the default one set in the SDK config.
|
|
396
|
+
folder_path (Optional[str]): The path of the folder. Override the default one set in the SDK config.
|
|
397
|
+
|
|
398
|
+
Raises:
|
|
399
|
+
Exception: If the link operation fails.
|
|
400
|
+
|
|
401
|
+
Examples:
|
|
402
|
+
```python
|
|
403
|
+
from uipath import UiPath
|
|
404
|
+
|
|
405
|
+
client = UiPath()
|
|
406
|
+
|
|
407
|
+
client.jobs.link_attachment(
|
|
408
|
+
attachment_key=uuid.UUID("123e4567-e89b-12d3-a456-426614174000"),
|
|
409
|
+
job_key=uuid.UUID("123e4567-e89b-12d3-a456-426614174001"),
|
|
410
|
+
category="Result"
|
|
411
|
+
)
|
|
412
|
+
print("Attachment linked to job successfully")
|
|
413
|
+
```
|
|
414
|
+
"""
|
|
415
|
+
spec = self._link_job_attachment_spec(
|
|
416
|
+
attachment_key=attachment_key,
|
|
417
|
+
job_key=job_key,
|
|
418
|
+
category=category,
|
|
419
|
+
folder_key=folder_key,
|
|
420
|
+
folder_path=folder_path,
|
|
421
|
+
)
|
|
422
|
+
|
|
423
|
+
return self.request(
|
|
424
|
+
spec.method,
|
|
425
|
+
url=spec.endpoint,
|
|
426
|
+
headers=spec.headers,
|
|
427
|
+
json=spec.json,
|
|
428
|
+
)
|
|
429
|
+
|
|
430
|
+
@traced(name="jobs_link_attachment", run_type="uipath")
|
|
431
|
+
async def link_attachment_async(
|
|
432
|
+
self,
|
|
433
|
+
*,
|
|
434
|
+
attachment_key: uuid.UUID,
|
|
435
|
+
job_key: uuid.UUID,
|
|
436
|
+
category: Optional[str] = None,
|
|
437
|
+
folder_key: Optional[str] = None,
|
|
438
|
+
folder_path: Optional[str] = None,
|
|
439
|
+
):
|
|
440
|
+
"""Link an attachment to a job asynchronously.
|
|
441
|
+
|
|
442
|
+
This method asynchronously links an existing attachment to a specific job.
|
|
443
|
+
|
|
444
|
+
Args:
|
|
445
|
+
attachment_key (uuid.UUID): The key of the attachment to link.
|
|
446
|
+
job_key (uuid.UUID): The key of the job to link the attachment to.
|
|
447
|
+
category (Optional[str]): Optional category for the attachment in the context of this job.
|
|
448
|
+
folder_key (Optional[str]): The key of the folder. Override the default one set in the SDK config.
|
|
449
|
+
folder_path (Optional[str]): The path of the folder. Override the default one set in the SDK config.
|
|
450
|
+
|
|
451
|
+
Raises:
|
|
452
|
+
Exception: If the link operation fails.
|
|
453
|
+
|
|
454
|
+
Examples:
|
|
455
|
+
```python
|
|
456
|
+
import asyncio
|
|
457
|
+
from uipath import UiPath
|
|
458
|
+
|
|
459
|
+
client = UiPath()
|
|
460
|
+
|
|
461
|
+
async def main():
|
|
462
|
+
await client.jobs.link_attachment_async(
|
|
463
|
+
attachment_key=uuid.UUID("123e4567-e89b-12d3-a456-426614174000"),
|
|
464
|
+
job_key=uuid.UUID("123e4567-e89b-12d3-a456-426614174001"),
|
|
465
|
+
category="Result"
|
|
466
|
+
)
|
|
467
|
+
print("Attachment linked to job successfully")
|
|
468
|
+
```
|
|
469
|
+
"""
|
|
470
|
+
spec = self._link_job_attachment_spec(
|
|
471
|
+
attachment_key=attachment_key,
|
|
472
|
+
job_key=job_key,
|
|
473
|
+
category=category,
|
|
474
|
+
folder_key=folder_key,
|
|
475
|
+
folder_path=folder_path,
|
|
476
|
+
)
|
|
477
|
+
|
|
478
|
+
return await self.request_async(
|
|
479
|
+
spec.method,
|
|
480
|
+
url=spec.endpoint,
|
|
481
|
+
headers=spec.headers,
|
|
482
|
+
json=spec.json,
|
|
483
|
+
)
|
|
484
|
+
|
|
485
|
+
def _list_job_attachments_spec(
|
|
486
|
+
self,
|
|
487
|
+
job_key: uuid.UUID,
|
|
488
|
+
folder_key: Optional[str] = None,
|
|
489
|
+
folder_path: Optional[str] = None,
|
|
490
|
+
) -> RequestSpec:
|
|
491
|
+
return RequestSpec(
|
|
492
|
+
method="GET",
|
|
493
|
+
endpoint=Endpoint("/orchestrator_/api/JobAttachments/GetByJobKey"),
|
|
494
|
+
params={
|
|
495
|
+
"jobKey": job_key,
|
|
496
|
+
},
|
|
497
|
+
headers={
|
|
498
|
+
**header_folder(folder_key, folder_path),
|
|
499
|
+
},
|
|
500
|
+
)
|
|
501
|
+
|
|
502
|
+
def _link_job_attachment_spec(
|
|
503
|
+
self,
|
|
504
|
+
attachment_key: uuid.UUID,
|
|
505
|
+
job_key: uuid.UUID,
|
|
506
|
+
category: Optional[str] = None,
|
|
507
|
+
folder_key: Optional[str] = None,
|
|
508
|
+
folder_path: Optional[str] = None,
|
|
509
|
+
) -> RequestSpec:
|
|
510
|
+
return RequestSpec(
|
|
511
|
+
method="POST",
|
|
512
|
+
endpoint=Endpoint("/orchestrator_/api/JobAttachments/Post"),
|
|
513
|
+
json={
|
|
514
|
+
"attachmentId": str(attachment_key),
|
|
515
|
+
"jobKey": str(job_key),
|
|
516
|
+
"category": category,
|
|
517
|
+
},
|
|
518
|
+
headers={
|
|
519
|
+
**header_folder(folder_key, folder_path),
|
|
520
|
+
},
|
|
521
|
+
)
|
uipath/_uipath.py
CHANGED
|
@@ -10,6 +10,7 @@ from ._services import (
|
|
|
10
10
|
ActionsService,
|
|
11
11
|
ApiClient,
|
|
12
12
|
AssetsService,
|
|
13
|
+
AttachmentsService,
|
|
13
14
|
BucketsService,
|
|
14
15
|
ConnectionsService,
|
|
15
16
|
ContextGroundingService,
|
|
@@ -69,6 +70,10 @@ class UiPath:
|
|
|
69
70
|
def assets(self) -> AssetsService:
|
|
70
71
|
return AssetsService(self._config, self._execution_context)
|
|
71
72
|
|
|
73
|
+
@property
|
|
74
|
+
def attachments(self) -> AttachmentsService:
|
|
75
|
+
return AttachmentsService(self._config, self._execution_context)
|
|
76
|
+
|
|
72
77
|
@property
|
|
73
78
|
def processes(self) -> ProcessesService:
|
|
74
79
|
return ProcessesService(self._config, self._execution_context)
|
uipath/models/__init__.py
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
from .action_schema import ActionSchema
|
|
2
2
|
from .actions import Action
|
|
3
3
|
from .assets import Asset, UserAsset
|
|
4
|
+
from .attachment import Attachment
|
|
4
5
|
from .buckets import Bucket
|
|
5
6
|
from .connections import Connection, ConnectionToken
|
|
6
7
|
from .context_grounding import ContextGroundingQueryResponse
|
|
@@ -26,6 +27,7 @@ from .queues import (
|
|
|
26
27
|
__all__ = [
|
|
27
28
|
"Action",
|
|
28
29
|
"Asset",
|
|
30
|
+
"Attachment",
|
|
29
31
|
"UserAsset",
|
|
30
32
|
"ContextGroundingQueryResponse",
|
|
31
33
|
"ContextGroundingIndex",
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import uuid
|
|
2
|
+
from datetime import datetime
|
|
3
|
+
from typing import Optional
|
|
4
|
+
|
|
5
|
+
from pydantic import BaseModel, ConfigDict, Field
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class Attachment(BaseModel):
|
|
9
|
+
"""Model representing an attachment in UiPath.
|
|
10
|
+
|
|
11
|
+
Attachments can be associated with jobs in UiPath and contain binary files or documents.
|
|
12
|
+
"""
|
|
13
|
+
|
|
14
|
+
model_config = ConfigDict(
|
|
15
|
+
validate_by_name=True,
|
|
16
|
+
validate_by_alias=True,
|
|
17
|
+
use_enum_values=True,
|
|
18
|
+
arbitrary_types_allowed=True,
|
|
19
|
+
extra="allow",
|
|
20
|
+
json_encoders={datetime: lambda v: v.isoformat() if v else None},
|
|
21
|
+
)
|
|
22
|
+
|
|
23
|
+
name: str = Field(alias="Name")
|
|
24
|
+
creation_time: Optional[datetime] = Field(default=None, alias="CreationTime")
|
|
25
|
+
last_modification_time: Optional[datetime] = Field(
|
|
26
|
+
default=None, alias="LastModificationTime"
|
|
27
|
+
)
|
|
28
|
+
key: uuid.UUID = Field(alias="Key")
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: uipath
|
|
3
|
-
Version: 2.0.
|
|
3
|
+
Version: 2.0.55
|
|
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
|
|
@@ -2,26 +2,26 @@ uipath/__init__.py,sha256=IaeKItOOQXMa95avueJ3dAq-XcRHyZVNjcCGwlSB000,634
|
|
|
2
2
|
uipath/_config.py,sha256=pi3qxPzDTxMEstj_XkGOgKJqD6RTHHv7vYv8sS_-d5Q,92
|
|
3
3
|
uipath/_execution_context.py,sha256=XyfEcdPN-PmM97yO7OVS8Do28N-vpTnQPJrkp8pEpRA,2434
|
|
4
4
|
uipath/_folder_context.py,sha256=UMMoU1VWEfYHAZW3Td2SIFYhw5dYsmaaKFhW_JEm6oc,1921
|
|
5
|
-
uipath/_uipath.py,sha256=
|
|
5
|
+
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=aIecyySuGXJEQHnS6b-M6sxM7ki5trjqq_J7s-sCdQE,3966
|
|
10
10
|
uipath/_cli/cli_deploy.py,sha256=KPCmQ0c_NYD5JofSDao5r6QYxHshVCRxlWDVnQvlp5w,645
|
|
11
11
|
uipath/_cli/cli_init.py,sha256=6qIjGFwfmeDs_7yzDqfl4zdnpDzlIjPAth0dY7kAP04,3736
|
|
12
12
|
uipath/_cli/cli_invoke.py,sha256=IjndcDWBpvAqGCRanQU1vfmxaBF8FhyZ7gWuZqwjHrU,3812
|
|
13
13
|
uipath/_cli/cli_new.py,sha256=9378NYUBc9j-qKVXV7oja-jahfJhXBg8zKVyaon7ctY,2102
|
|
14
14
|
uipath/_cli/cli_pack.py,sha256=8Ahk0vr_8eqMsq9ehhYWNfeII0VIiZVBXMpRF7Dbvtg,15018
|
|
15
15
|
uipath/_cli/cli_publish.py,sha256=Ba0TJ1TSfuQbLU2AIgtM8QWkLHgr4tsAP1CaX12113U,6010
|
|
16
|
-
uipath/_cli/cli_run.py,sha256=
|
|
16
|
+
uipath/_cli/cli_run.py,sha256=0q_DqM2QNfD8yOqUZB_5BTg96pCLzbHE1enD_XAj6CE,5215
|
|
17
17
|
uipath/_cli/middlewares.py,sha256=IiJgjsqrJVKSXx4RcIKHWoH-SqWqpHPbhzkQEybmAos,3937
|
|
18
18
|
uipath/_cli/spinner.py,sha256=bS-U_HA5yne11ejUERu7CQoXmWdabUD2bm62EfEdV8M,1107
|
|
19
|
-
uipath/_cli/_auth/_auth_server.py,sha256=
|
|
19
|
+
uipath/_cli/_auth/_auth_server.py,sha256=p93_EvJpdoLLkiVmLygHRKo9ru1-PZOEAaEhNFN3j6c,6424
|
|
20
20
|
uipath/_cli/_auth/_models.py,sha256=sYMCfvmprIqnZxStlD_Dxx2bcxgn0Ri4D7uwemwkcNg,948
|
|
21
21
|
uipath/_cli/_auth/_oidc_utils.py,sha256=WaX9jDlXrlX6yD8i8gsocV8ngjaT72Xd1tvsZMmSbco,2127
|
|
22
22
|
uipath/_cli/_auth/_portal_service.py,sha256=80W0cn3rx6NEi_b15aSQ0ZQWFv7Om7SaOlkUUk2k7pA,7240
|
|
23
23
|
uipath/_cli/_auth/_utils.py,sha256=9nb76xe5XmDZ0TAncp-_1SKqL6FdwRi9eS3C2noN1lY,1591
|
|
24
|
-
uipath/_cli/_auth/auth_config.json,sha256=
|
|
24
|
+
uipath/_cli/_auth/auth_config.json,sha256=OCNp3tTF2WL83pyJlZw-Wt8Slao9IpmmZJonl2OvaRw,340
|
|
25
25
|
uipath/_cli/_auth/index.html,sha256=ML_xDOcKs0ETYucufJskiYfWSvdrD_E26C0Qd3qpGj8,6280
|
|
26
26
|
uipath/_cli/_auth/localhost.crt,sha256=oGl9oLLOiouHubAt39B4zEfylFvKEtbtr_43SIliXJc,1226
|
|
27
27
|
uipath/_cli/_auth/localhost.key,sha256=X31VYXD8scZtmGA837dGX5l6G-LXHLo5ItWJhZXaz3c,1679
|
|
@@ -39,16 +39,17 @@ uipath/_cli/_utils/_folders.py,sha256=usjLNOMdhvelEv0wsJ-v6q-qiUR1tbwXJL4Sd_SOoc
|
|
|
39
39
|
uipath/_cli/_utils/_input_args.py,sha256=pyQhEcQXHdFHYTVNzvfWp439aii5StojoptnmCv5lfs,4094
|
|
40
40
|
uipath/_cli/_utils/_parse_ast.py,sha256=3XVjnhJNnSfjXlitct91VOtqSl0l-sqDpoWww28mMc0,20663
|
|
41
41
|
uipath/_cli/_utils/_processes.py,sha256=iCGNf1y_K_r3bdmX9VWA70UP20bdUzKlMRrAxkdkdm4,1669
|
|
42
|
-
uipath/_services/__init__.py,sha256=
|
|
42
|
+
uipath/_services/__init__.py,sha256=10xtw3ENC30yR9CCq_b94RMZ3YrUeyfHV33yWYUd8tU,896
|
|
43
43
|
uipath/_services/_base_service.py,sha256=y-QATIRF9JnUFKIwmjOWMHlE2BrJYgD8y4sGAve2kEM,5338
|
|
44
44
|
uipath/_services/actions_service.py,sha256=LYKvG4VxNGQgZ46AzGK9kI1Txb-YmVvZj5ScPOue8Ls,15989
|
|
45
45
|
uipath/_services/api_client.py,sha256=hcof0EMa4-phEHD1WlO7Tdfzq6aL18Sbi2aBE7lJm1w,1821
|
|
46
46
|
uipath/_services/assets_service.py,sha256=gfQLCchT6evsmhip1-coX6oFbshoKUWlxwGrS6DGcHU,13200
|
|
47
|
+
uipath/_services/attachments_service.py,sha256=8iRdauPFzhJv65Uus69BBmA3jPckqfwBE4iGbXvktCQ,19653
|
|
47
48
|
uipath/_services/buckets_service.py,sha256=xTIAEs7EbpyZYqd7PG1q0emOOBM_Ca0rVoH417g2bl0,17521
|
|
48
49
|
uipath/_services/connections_service.py,sha256=qh-HNL_GJsyPUD0wSJZRF8ZdrTE9l4HrIilmXGK6dDk,4581
|
|
49
50
|
uipath/_services/context_grounding_service.py,sha256=wRYPnpTFeZunS88OggRZ9qRaILHKdoEP_6VUCaF-Xw0,24097
|
|
50
51
|
uipath/_services/folder_service.py,sha256=HtsBoBejvMuIZ-9gocAG9B8uKOFsAAD4WUozta-isXk,1673
|
|
51
|
-
uipath/_services/jobs_service.py,sha256=
|
|
52
|
+
uipath/_services/jobs_service.py,sha256=Z1CmglIe6pFt0XovPLbuLCp13mWQw92MgjfRivqsodE,16745
|
|
52
53
|
uipath/_services/llm_gateway_service.py,sha256=ySg3sflIoXmY9K7txlSm7bkuI2qzBT0kAKmGlFBk5KA,12032
|
|
53
54
|
uipath/_services/processes_service.py,sha256=12tflrzTNvtA0xGteQwrIZ0s-jCTinTv7gktder5tRE,5659
|
|
54
55
|
uipath/_services/queues_service.py,sha256=VaG3dWL2QK6AJBOLoW2NQTpkPfZjsqsYPl9-kfXPFzA,13534
|
|
@@ -62,10 +63,11 @@ uipath/_utils/_request_spec.py,sha256=iCtBLqtbWUpFG5g1wtIZBzSupKsfaRLiQFoFc_4B70
|
|
|
62
63
|
uipath/_utils/_url.py,sha256=2PnINXuEPbhd9mlojJJdupm-sOrgV29o5DbWuaFrc-0,2039
|
|
63
64
|
uipath/_utils/_user_agent.py,sha256=pVJkFYacGwaQBomfwWVAvBQgdBUo62e4n3-fLIajWUU,563
|
|
64
65
|
uipath/_utils/constants.py,sha256=CKv-kTC8Fzu6E_KY9jD_fSt0Gbycn9sZg4O_3pzq2fo,873
|
|
65
|
-
uipath/models/__init__.py,sha256=
|
|
66
|
+
uipath/models/__init__.py,sha256=Kwqv1LzWNfSxJLMQrInVen3KDJ1z0eCcr6szQa0G0VE,1251
|
|
66
67
|
uipath/models/action_schema.py,sha256=lKDhP7Eix23fFvfQrqqNmSOiPyyNF6tiRpUu0VZIn_M,714
|
|
67
68
|
uipath/models/actions.py,sha256=ekSH4YUQR4KPOH-heBm9yOgOfirndx0In4_S4VYWeEU,2993
|
|
68
69
|
uipath/models/assets.py,sha256=Q-7_xmm503XHTKgCDrDtXsFl3VWBSVSyiWYW0mZjsnA,2942
|
|
70
|
+
uipath/models/attachment.py,sha256=prBlhhTvaBnLXJ3PKKxxHWbus35dCuag3_5HngksUjU,843
|
|
69
71
|
uipath/models/buckets.py,sha256=N3Lj_dVCv709-ywhOOdyCSvsuLn41eGuAfSiik6Q6F8,1285
|
|
70
72
|
uipath/models/connections.py,sha256=perIqW99YEg_0yWZPdpZlmNpZcwY_toR1wkqDUBdAN0,2014
|
|
71
73
|
uipath/models/context_grounding.py,sha256=S9PeOlFlw7VxzzJVR_Fs28OObW3MLHUPCFqNgkEz24k,1315
|
|
@@ -84,8 +86,8 @@ uipath/tracing/__init__.py,sha256=GimSzv6qkCOlHOG1WtjYKJsZqcXpA28IgoXfR33JhiA,13
|
|
|
84
86
|
uipath/tracing/_otel_exporters.py,sha256=x0PDPmDKJcxashsuehVsSsqBCzRr6WsNFaq_3_HS5F0,3014
|
|
85
87
|
uipath/tracing/_traced.py,sha256=GFxOp73jk0vGTN_H7YZOOsEl9rVLaEhXGztMiYKIA-8,16634
|
|
86
88
|
uipath/tracing/_utils.py,sha256=5SwsTGpHkIouXBndw-u8eCLnN4p7LM8DsTCCuf2jJgs,10165
|
|
87
|
-
uipath-2.0.
|
|
88
|
-
uipath-2.0.
|
|
89
|
-
uipath-2.0.
|
|
90
|
-
uipath-2.0.
|
|
91
|
-
uipath-2.0.
|
|
89
|
+
uipath-2.0.55.dist-info/METADATA,sha256=fvYKsM_vqRzxyTDGh_0fK1vNc7_rLxGRQFWvhfwVCik,6304
|
|
90
|
+
uipath-2.0.55.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
91
|
+
uipath-2.0.55.dist-info/entry_points.txt,sha256=9C2_29U6Oq1ExFu7usihR-dnfIVNSKc-0EFbh0rskB4,43
|
|
92
|
+
uipath-2.0.55.dist-info/licenses/LICENSE,sha256=-KBavWXepyDjimmzH5fVAsi-6jNVpIKFc2kZs0Ri4ng,1058
|
|
93
|
+
uipath-2.0.55.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|