nacwrap 0.2.4__tar.gz → 0.2.6__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.2.4/nacwrap.egg-info → nacwrap-0.2.6}/PKG-INFO +1 -1
- {nacwrap-0.2.4 → nacwrap-0.2.6}/nacwrap/instances.py +1 -3
- {nacwrap-0.2.4 → nacwrap-0.2.6}/nacwrap/tasks.py +77 -25
- {nacwrap-0.2.4 → nacwrap-0.2.6/nacwrap.egg-info}/PKG-INFO +1 -1
- {nacwrap-0.2.4 → nacwrap-0.2.6}/setup.py +1 -1
- {nacwrap-0.2.4 → nacwrap-0.2.6}/tests/test.py +3 -4
- {nacwrap-0.2.4 → nacwrap-0.2.6}/LICENSE +0 -0
- {nacwrap-0.2.4 → nacwrap-0.2.6}/MANIFEST.in +0 -0
- {nacwrap-0.2.4 → nacwrap-0.2.6}/README.md +0 -0
- {nacwrap-0.2.4 → nacwrap-0.2.6}/nacwrap/__init__.py +0 -0
- {nacwrap-0.2.4 → nacwrap-0.2.6}/nacwrap/_auth.py +0 -0
- {nacwrap-0.2.4 → nacwrap-0.2.6}/nacwrap/_helpers.py +0 -0
- {nacwrap-0.2.4 → nacwrap-0.2.6}/nacwrap/connections.py +0 -0
- {nacwrap-0.2.4 → nacwrap-0.2.6}/nacwrap/data_model.py +0 -0
- {nacwrap-0.2.4 → nacwrap-0.2.6}/nacwrap/datasources.py +0 -0
- {nacwrap-0.2.4 → nacwrap-0.2.6}/nacwrap/exceptions.py +0 -0
- {nacwrap-0.2.4 → nacwrap-0.2.6}/nacwrap/nacwrap.py +0 -0
- {nacwrap-0.2.4 → nacwrap-0.2.6}/nacwrap/users.py +0 -0
- {nacwrap-0.2.4 → nacwrap-0.2.6}/nacwrap/workflows.py +0 -0
- {nacwrap-0.2.4 → nacwrap-0.2.6}/nacwrap.egg-info/SOURCES.txt +0 -0
- {nacwrap-0.2.4 → nacwrap-0.2.6}/nacwrap.egg-info/dependency_links.txt +0 -0
- {nacwrap-0.2.4 → nacwrap-0.2.6}/nacwrap.egg-info/requires.txt +0 -0
- {nacwrap-0.2.4 → nacwrap-0.2.6}/nacwrap.egg-info/top_level.txt +0 -0
- {nacwrap-0.2.4 → nacwrap-0.2.6}/requirements.txt +0 -0
- {nacwrap-0.2.4 → nacwrap-0.2.6}/setup.cfg +0 -0
|
@@ -194,9 +194,7 @@ def instances_list(
|
|
|
194
194
|
"from": (
|
|
195
195
|
from_datetime.strftime("%Y-%m-%dT%H:%M:%S.%fZ") if from_datetime else None
|
|
196
196
|
),
|
|
197
|
-
"to": to_datetime.strftime("%Y-%m-%
|
|
198
|
-
if to_datetime
|
|
199
|
-
else None,
|
|
197
|
+
"to": to_datetime.strftime("%Y-%m-%dT%H:%M:%S.%fZ") if to_datetime else None,
|
|
200
198
|
"pageSize": page_size,
|
|
201
199
|
}
|
|
202
200
|
|
|
@@ -1,21 +1,17 @@
|
|
|
1
1
|
import os
|
|
2
|
-
from
|
|
3
|
-
from datetime import date, datetime
|
|
4
|
-
from typing import Literal, Optional, Union, List
|
|
5
|
-
import requests
|
|
6
|
-
from pprint import pprint
|
|
7
|
-
from pydantic import BaseModel, Field
|
|
2
|
+
from datetime import date
|
|
8
3
|
|
|
4
|
+
import requests
|
|
9
5
|
from nacwrap._auth import Decorators
|
|
10
6
|
from nacwrap._helpers import _fetch_page, _put
|
|
11
|
-
from nacwrap.data_model import
|
|
7
|
+
from nacwrap.data_model import NintexTask, TaskStatus
|
|
12
8
|
|
|
13
9
|
"""
|
|
14
10
|
This module contains functions relating to individual task assignments.
|
|
15
11
|
"""
|
|
16
12
|
|
|
17
13
|
|
|
18
|
-
def task_delegate(assignmentId: str, taskId: str, assignees:
|
|
14
|
+
def task_delegate(assignmentId: str, taskId: str, assignees: list[str], message: str):
|
|
19
15
|
"""
|
|
20
16
|
Delegate a Nintex Task to another user.
|
|
21
17
|
|
|
@@ -60,13 +56,13 @@ def task_delegate(assignmentId: str, taskId: str, assignees: List[str], message:
|
|
|
60
56
|
|
|
61
57
|
@Decorators.refresh_token
|
|
62
58
|
def task_search(
|
|
63
|
-
workflow_name: str = None,
|
|
64
|
-
instance_id: str = None,
|
|
65
|
-
status: TaskStatus = None,
|
|
66
|
-
assignee: str = None,
|
|
67
|
-
dt_from: date = None,
|
|
68
|
-
dt_to: date = None,
|
|
69
|
-
) ->
|
|
59
|
+
workflow_name: str | None = None,
|
|
60
|
+
instance_id: str | None = None,
|
|
61
|
+
status: TaskStatus | None = None,
|
|
62
|
+
assignee: str | None = None,
|
|
63
|
+
dt_from: date | None = None,
|
|
64
|
+
dt_to: date | None = None,
|
|
65
|
+
) -> list[dict]:
|
|
70
66
|
"""
|
|
71
67
|
Get Nintex Task data.
|
|
72
68
|
Returns: List of Dictionaries.
|
|
@@ -135,13 +131,13 @@ def task_search(
|
|
|
135
131
|
|
|
136
132
|
|
|
137
133
|
def task_search_pd(
|
|
138
|
-
workflow_name: str = None,
|
|
139
|
-
instance_id: str = None,
|
|
140
|
-
status: TaskStatus = None,
|
|
141
|
-
assignee: str = None,
|
|
142
|
-
dt_from: date = None,
|
|
143
|
-
dt_to: date = None,
|
|
144
|
-
) ->
|
|
134
|
+
workflow_name: str | None = None,
|
|
135
|
+
instance_id: str | None = None,
|
|
136
|
+
status: TaskStatus | None = None,
|
|
137
|
+
assignee: str | None = None,
|
|
138
|
+
dt_from: date | None = None,
|
|
139
|
+
dt_to: date | None = None,
|
|
140
|
+
) -> list[NintexTask]:
|
|
145
141
|
"""
|
|
146
142
|
Get Nintex Task data.
|
|
147
143
|
Returns: List of NintexTask pydantic objects.
|
|
@@ -165,13 +161,69 @@ def task_search_pd(
|
|
|
165
161
|
dt_from=dt_from,
|
|
166
162
|
dt_to=dt_to,
|
|
167
163
|
)
|
|
168
|
-
results:
|
|
164
|
+
results: list[NintexTask] = []
|
|
169
165
|
for task in task_dict:
|
|
170
166
|
results.append(NintexTask(**task))
|
|
171
167
|
|
|
172
168
|
return results
|
|
173
169
|
|
|
174
170
|
|
|
175
|
-
|
|
171
|
+
@Decorators.refresh_token
|
|
172
|
+
def task_complete(taskId: str, assignmentId: str, outcome: str):
|
|
173
|
+
"""
|
|
174
|
+
Completes a Nintex task assignment.
|
|
175
|
+
|
|
176
|
+
:param taskId: ID of the task to complete.
|
|
177
|
+
:param assignmentId: ID of the task assignment to complete.
|
|
178
|
+
:param outcome: Outcome of the task completion. MUST match one of the outcomes
|
|
179
|
+
defined in the given task definition.
|
|
180
|
+
"""
|
|
181
|
+
url = (
|
|
182
|
+
os.environ["NINTEX_BASE_URL"]
|
|
183
|
+
+ f"/workflows/v2/tasks/{taskId}/assignments/{assignmentId}"
|
|
184
|
+
)
|
|
185
|
+
|
|
186
|
+
try:
|
|
187
|
+
response = requests.patch(
|
|
188
|
+
url,
|
|
189
|
+
headers={
|
|
190
|
+
"Authorization": "Bearer " + os.environ["NTX_BEARER_TOKEN"],
|
|
191
|
+
"Content-Type": "application/json",
|
|
192
|
+
},
|
|
193
|
+
json={"outcome": outcome},
|
|
194
|
+
)
|
|
195
|
+
response.raise_for_status()
|
|
196
|
+
except requests.exceptions.HTTPError as e:
|
|
197
|
+
raise Exception(
|
|
198
|
+
f"HTTP Error when completing task: {e.response.status_code} - {e.response.content}"
|
|
199
|
+
)
|
|
200
|
+
except requests.exceptions.RequestException as e:
|
|
201
|
+
raise Exception(f"Error, could not complete task: {e}")
|
|
202
|
+
|
|
203
|
+
return response.json()
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
@Decorators.refresh_token
|
|
207
|
+
def task_get(taskId: str):
|
|
208
|
+
"""
|
|
209
|
+
Get the details of a specific Nintex task.
|
|
210
|
+
"""
|
|
211
|
+
url = os.environ["NINTEX_BASE_URL"] + f"/workflows/v2/tasks/{taskId}"
|
|
212
|
+
|
|
213
|
+
try:
|
|
214
|
+
response = requests.get(
|
|
215
|
+
url,
|
|
216
|
+
headers={
|
|
217
|
+
"Authorization": "Bearer " + os.environ["NTX_BEARER_TOKEN"],
|
|
218
|
+
"Content-Type": "application/json",
|
|
219
|
+
},
|
|
220
|
+
)
|
|
221
|
+
response.raise_for_status()
|
|
222
|
+
except requests.exceptions.HTTPError as e:
|
|
223
|
+
raise Exception(
|
|
224
|
+
f"HTTP Error when getting task: {e.response.status_code} - {e.response.content}"
|
|
225
|
+
)
|
|
226
|
+
except requests.exceptions.RequestException as e:
|
|
227
|
+
raise Exception(f"Error, could not get task: {e}")
|
|
176
228
|
|
|
177
|
-
|
|
229
|
+
return response.json()
|
|
@@ -8,7 +8,7 @@ with open("README.md", "r") as f:
|
|
|
8
8
|
|
|
9
9
|
setup(
|
|
10
10
|
name="nacwrap",
|
|
11
|
-
version="0.2.
|
|
11
|
+
version="0.2.6",
|
|
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",
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import os
|
|
2
1
|
import sys
|
|
3
2
|
from datetime import datetime, timedelta
|
|
4
|
-
from pprint import pprint
|
|
5
3
|
|
|
6
4
|
from dotenv import load_dotenv
|
|
7
5
|
|
|
@@ -12,8 +10,9 @@ sys.path.insert(0, "")
|
|
|
12
10
|
|
|
13
11
|
from nacwrap import nacwrap
|
|
14
12
|
|
|
15
|
-
|
|
13
|
+
fr = datetime.now() - timedelta(hours=3)
|
|
14
|
+
to = datetime.now()
|
|
16
15
|
|
|
17
|
-
|
|
16
|
+
res = nacwrap.instances_list(workflow_name="Form 279", from_datetime=fr, to_datetime=to)
|
|
18
17
|
|
|
19
18
|
pass
|
|
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
|
|
File without changes
|