nacwrap 0.3.0__tar.gz → 0.3.2__tar.gz
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.
- {nacwrap-0.3.0/nacwrap.egg-info → nacwrap-0.3.2}/PKG-INFO +1 -1
- {nacwrap-0.3.0 → nacwrap-0.3.2}/nacwrap/__init__.py +3 -1
- {nacwrap-0.3.0 → nacwrap-0.3.2}/nacwrap/instances.py +2 -1
- {nacwrap-0.3.0 → nacwrap-0.3.2}/nacwrap/tasks.py +75 -4
- {nacwrap-0.3.0 → nacwrap-0.3.2/nacwrap.egg-info}/PKG-INFO +1 -1
- {nacwrap-0.3.0 → nacwrap-0.3.2}/setup.py +1 -1
- {nacwrap-0.3.0 → nacwrap-0.3.2}/LICENSE +0 -0
- {nacwrap-0.3.0 → nacwrap-0.3.2}/MANIFEST.in +0 -0
- {nacwrap-0.3.0 → nacwrap-0.3.2}/README.md +0 -0
- {nacwrap-0.3.0 → nacwrap-0.3.2}/nacwrap/_auth.py +0 -0
- {nacwrap-0.3.0 → nacwrap-0.3.2}/nacwrap/_helpers.py +0 -0
- {nacwrap-0.3.0 → nacwrap-0.3.2}/nacwrap/connections.py +0 -0
- {nacwrap-0.3.0 → nacwrap-0.3.2}/nacwrap/data_model.py +0 -0
- {nacwrap-0.3.0 → nacwrap-0.3.2}/nacwrap/datasources.py +0 -0
- {nacwrap-0.3.0 → nacwrap-0.3.2}/nacwrap/exceptions.py +0 -0
- {nacwrap-0.3.0 → nacwrap-0.3.2}/nacwrap/users.py +0 -0
- {nacwrap-0.3.0 → nacwrap-0.3.2}/nacwrap/workflows.py +0 -0
- {nacwrap-0.3.0 → nacwrap-0.3.2}/nacwrap.egg-info/SOURCES.txt +0 -0
- {nacwrap-0.3.0 → nacwrap-0.3.2}/nacwrap.egg-info/dependency_links.txt +0 -0
- {nacwrap-0.3.0 → nacwrap-0.3.2}/nacwrap.egg-info/requires.txt +0 -0
- {nacwrap-0.3.0 → nacwrap-0.3.2}/nacwrap.egg-info/top_level.txt +0 -0
- {nacwrap-0.3.0 → nacwrap-0.3.2}/requirements.txt +0 -0
- {nacwrap-0.3.0 → nacwrap-0.3.2}/setup.cfg +0 -0
- {nacwrap-0.3.0 → nacwrap-0.3.2}/tests/test.py +0 -0
|
@@ -24,7 +24,7 @@ from .instances import (
|
|
|
24
24
|
instances_list,
|
|
25
25
|
instances_list_pd,
|
|
26
26
|
)
|
|
27
|
-
from .tasks import task_delegate, task_search, task_search_pd
|
|
27
|
+
from .tasks import task_complete, task_delegate, task_get, task_search, task_search_pd
|
|
28
28
|
from .users import user_delete, users_list, users_list_pd
|
|
29
29
|
from .workflows import workflows_list, workflows_list_pd
|
|
30
30
|
|
|
@@ -47,7 +47,9 @@ __all__ = [
|
|
|
47
47
|
"instance_start_data_pd",
|
|
48
48
|
"instances_list",
|
|
49
49
|
"instances_list_pd",
|
|
50
|
+
"task_complete",
|
|
50
51
|
"task_delegate",
|
|
52
|
+
"task_get",
|
|
51
53
|
"task_search",
|
|
52
54
|
"task_search_pd",
|
|
53
55
|
"user_delete",
|
|
@@ -17,6 +17,7 @@ from nacwrap.data_model import (
|
|
|
17
17
|
InstanceStartData,
|
|
18
18
|
NintexInstance,
|
|
19
19
|
ResolveType,
|
|
20
|
+
WorkflowStatus,
|
|
20
21
|
)
|
|
21
22
|
|
|
22
23
|
logger = logging.getLogger(__name__)
|
|
@@ -141,7 +142,7 @@ def instance_get_pd(instanceId: str) -> InstanceActions:
|
|
|
141
142
|
def instances_list(
|
|
142
143
|
workflow_name: Optional[str] = None,
|
|
143
144
|
instance_name: str | None = None,
|
|
144
|
-
status:
|
|
145
|
+
status: WorkflowStatus | None = None,
|
|
145
146
|
order_by: Union[Literal["ASC", "DESC"], None] = None,
|
|
146
147
|
from_datetime: Optional[datetime] = None,
|
|
147
148
|
to_datetime: Optional[datetime] = None,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"""
|
|
2
|
-
This module contains functions relating to individual
|
|
2
|
+
This module contains functions relating to individual tasks and assignments.
|
|
3
3
|
"""
|
|
4
4
|
|
|
5
5
|
import logging
|
|
@@ -8,12 +8,13 @@ from datetime import date
|
|
|
8
8
|
|
|
9
9
|
import requests
|
|
10
10
|
from nacwrap._auth import Decorators
|
|
11
|
-
from nacwrap._helpers import _fetch_page, _put
|
|
11
|
+
from nacwrap._helpers import _basic_retry, _fetch_page, _put
|
|
12
12
|
from nacwrap.data_model import NintexTask, TaskStatus
|
|
13
13
|
|
|
14
14
|
logger = logging.getLogger(__name__)
|
|
15
15
|
|
|
16
16
|
|
|
17
|
+
@Decorators.refresh_token
|
|
17
18
|
def task_delegate(assignmentId: str, taskId: str, assignees: list[str], message: str):
|
|
18
19
|
"""
|
|
19
20
|
Delegate a Nintex Task to another user.
|
|
@@ -179,6 +180,76 @@ def task_search_pd(
|
|
|
179
180
|
return results
|
|
180
181
|
|
|
181
182
|
|
|
182
|
-
|
|
183
|
+
@_basic_retry
|
|
184
|
+
@Decorators.refresh_token
|
|
185
|
+
def task_get(task_id: str) -> dict:
|
|
186
|
+
"""
|
|
187
|
+
Get the details of a specific task
|
|
188
|
+
|
|
189
|
+
:param task_id: The unique identifier for the task
|
|
190
|
+
"""
|
|
191
|
+
|
|
192
|
+
url = os.environ["NINTEX_BASE_URL"] + f"/workflows/v2/tasks/{task_id}"
|
|
193
|
+
|
|
194
|
+
try:
|
|
195
|
+
response = requests.get(
|
|
196
|
+
url,
|
|
197
|
+
headers={
|
|
198
|
+
"Authorization": "Bearer " + os.environ["NTX_BEARER_TOKEN"],
|
|
199
|
+
"Content-Type": "application/json",
|
|
200
|
+
},
|
|
201
|
+
)
|
|
202
|
+
response.raise_for_status()
|
|
203
|
+
|
|
204
|
+
except requests.exceptions.HTTPError as e:
|
|
205
|
+
logger.error(
|
|
206
|
+
f"HTTP Error when getting task: {e.response.status_code} - {e.response.content}"
|
|
207
|
+
)
|
|
208
|
+
raise Exception(
|
|
209
|
+
f"HTTP Error when getting task: {e.response.status_code} - {e.response.content}"
|
|
210
|
+
)
|
|
211
|
+
|
|
212
|
+
except requests.exceptions.RequestException as e:
|
|
213
|
+
logger.error(f"Error, could not get task: {e}")
|
|
214
|
+
raise Exception(f"Error, could not get task: {e}")
|
|
215
|
+
|
|
216
|
+
return response.json()
|
|
217
|
+
|
|
183
218
|
|
|
184
|
-
|
|
219
|
+
@Decorators.refresh_token
|
|
220
|
+
def task_complete(task_id: str, assignment_id: str, outcome: str):
|
|
221
|
+
"""
|
|
222
|
+
Complete a task and specify an outcome.
|
|
223
|
+
:param task_id: The unique identifier for the task
|
|
224
|
+
:param assignment_id: The unique identifier for the task assignment
|
|
225
|
+
:param outcome: Outcome of the task assignment, must match one of the tasks's defined outcomes
|
|
226
|
+
"""
|
|
227
|
+
|
|
228
|
+
url = (
|
|
229
|
+
os.environ["NINTEX_BASE_URL"]
|
|
230
|
+
+ f"/workflows/v2/tasks/{task_id}/assignments/{assignment_id}"
|
|
231
|
+
)
|
|
232
|
+
|
|
233
|
+
try:
|
|
234
|
+
response = requests.patch(
|
|
235
|
+
url,
|
|
236
|
+
headers={
|
|
237
|
+
"Authorization": "Bearer " + os.environ["NTX_BEARER_TOKEN"],
|
|
238
|
+
"Content-Type": "application/json",
|
|
239
|
+
},
|
|
240
|
+
data={"outcome": outcome},
|
|
241
|
+
)
|
|
242
|
+
response.raise_for_status()
|
|
243
|
+
except requests.exceptions.HTTPError as e:
|
|
244
|
+
logger.error(
|
|
245
|
+
f"HTTP Error when completing task: {e.response.status_code} - {e.response.content}"
|
|
246
|
+
)
|
|
247
|
+
raise Exception(
|
|
248
|
+
f"HTTP Error when completing task: {e.response.status_code} - {e.response.content}"
|
|
249
|
+
)
|
|
250
|
+
|
|
251
|
+
except requests.exceptions.RequestException as e:
|
|
252
|
+
logger.error(f"Error, could not complete task: {e}")
|
|
253
|
+
raise Exception(f"Error, could not complete task: {e}")
|
|
254
|
+
|
|
255
|
+
logger.info(f"Response Status: {response.status_code}")
|
|
@@ -8,7 +8,7 @@ with open("README.md", "r") as f:
|
|
|
8
8
|
|
|
9
9
|
setup(
|
|
10
10
|
name="nacwrap",
|
|
11
|
-
version="0.3.
|
|
11
|
+
version="0.3.2",
|
|
12
12
|
description="Python package that acts as a wrapper for the Nintex Automation Cloud system.",
|
|
13
13
|
long_description=long_description,
|
|
14
14
|
long_description_content_type="text/markdown",
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|