nacwrap 0.2.2__tar.gz → 0.2.4__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.
Files changed (27) hide show
  1. {nacwrap-0.2.2/nacwrap.egg-info → nacwrap-0.2.4}/PKG-INFO +15 -3
  2. {nacwrap-0.2.2 → nacwrap-0.2.4}/README.md +4 -2
  3. nacwrap-0.2.4/nacwrap/connections.py +35 -0
  4. nacwrap-0.2.4/nacwrap/datasources.py +68 -0
  5. {nacwrap-0.2.2 → nacwrap-0.2.4}/nacwrap/instances.py +19 -5
  6. {nacwrap-0.2.2 → nacwrap-0.2.4}/nacwrap/nacwrap.py +4 -2
  7. {nacwrap-0.2.2 → nacwrap-0.2.4/nacwrap.egg-info}/PKG-INFO +15 -3
  8. {nacwrap-0.2.2 → nacwrap-0.2.4}/setup.py +1 -1
  9. {nacwrap-0.2.2 → nacwrap-0.2.4}/tests/test.py +4 -4
  10. nacwrap-0.2.2/nacwrap/connections.py +0 -0
  11. nacwrap-0.2.2/nacwrap/datasources.py +0 -0
  12. {nacwrap-0.2.2 → nacwrap-0.2.4}/LICENSE +0 -0
  13. {nacwrap-0.2.2 → nacwrap-0.2.4}/MANIFEST.in +0 -0
  14. {nacwrap-0.2.2 → nacwrap-0.2.4}/nacwrap/__init__.py +0 -0
  15. {nacwrap-0.2.2 → nacwrap-0.2.4}/nacwrap/_auth.py +0 -0
  16. {nacwrap-0.2.2 → nacwrap-0.2.4}/nacwrap/_helpers.py +0 -0
  17. {nacwrap-0.2.2 → nacwrap-0.2.4}/nacwrap/data_model.py +0 -0
  18. {nacwrap-0.2.2 → nacwrap-0.2.4}/nacwrap/exceptions.py +0 -0
  19. {nacwrap-0.2.2 → nacwrap-0.2.4}/nacwrap/tasks.py +0 -0
  20. {nacwrap-0.2.2 → nacwrap-0.2.4}/nacwrap/users.py +0 -0
  21. {nacwrap-0.2.2 → nacwrap-0.2.4}/nacwrap/workflows.py +0 -0
  22. {nacwrap-0.2.2 → nacwrap-0.2.4}/nacwrap.egg-info/SOURCES.txt +0 -0
  23. {nacwrap-0.2.2 → nacwrap-0.2.4}/nacwrap.egg-info/dependency_links.txt +0 -0
  24. {nacwrap-0.2.2 → nacwrap-0.2.4}/nacwrap.egg-info/requires.txt +0 -0
  25. {nacwrap-0.2.2 → nacwrap-0.2.4}/nacwrap.egg-info/top_level.txt +0 -0
  26. {nacwrap-0.2.2 → nacwrap-0.2.4}/requirements.txt +0 -0
  27. {nacwrap-0.2.2 → nacwrap-0.2.4}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: nacwrap
3
- Version: 0.2.2
3
+ Version: 0.2.4
4
4
  Summary: Python package that acts as a wrapper for the Nintex Automation Cloud system.
5
5
  Home-page: https://github.com/pepsimidamerica/nacwrap
6
6
  Author: Jordan Maynor
@@ -14,6 +14,16 @@ License-File: LICENSE
14
14
  Requires-Dist: requests
15
15
  Requires-Dist: tenacity
16
16
  Requires-Dist: pydantic
17
+ Dynamic: author
18
+ Dynamic: author-email
19
+ Dynamic: classifier
20
+ Dynamic: description
21
+ Dynamic: description-content-type
22
+ Dynamic: home-page
23
+ Dynamic: license-file
24
+ Dynamic: requires-dist
25
+ Dynamic: requires-python
26
+ Dynamic: summary
17
27
 
18
28
  # Overview
19
29
 
@@ -37,12 +47,12 @@ Several environment variables are required for nacwrap to function.
37
47
  ### Instances - Create Instance
38
48
 
39
49
  Function to create a workflow instance. Takes in two parameters.
50
+
40
51
  | Param | Description |
41
52
  | ----------- | ----------------------------------------------------------------------------------------------------------------------------- |
42
53
  | workflow_id | The ID of the workflow you want to create an instance for. |
43
54
  | start_data | Optional, any start data the worklfow requires. Should be provided in dictionary format. Returns JSON response if successful. |
44
55
 
45
-
46
56
  ### Instances - List Instances
47
57
 
48
58
  Function to return instance data. Takes a number of parameters for filtering what instance data to get.
@@ -54,6 +64,7 @@ Make function to delegate tasks from one user to another.
54
64
  ### Tasks - Task Search
55
65
 
56
66
  Returns Nintex Tasks as a list of NintexTask objects. Takes a number of parameters for filtering what tasks to retrieve.
67
+
57
68
  | Param | Description |
58
69
  | ------------- | ----------------------------------------------------- |
59
70
  | workflow_name | Limit results to workflows matching this name. |
@@ -66,6 +77,7 @@ Returns Nintex Tasks as a list of NintexTask objects. Takes a number of paramete
66
77
  ### Users - List Users
67
78
 
68
79
  Returns Nintex Users as a list of NintexUser objects. Takes a number of parameters for filtering what users to retrieve.
80
+
69
81
  | Param | Description |
70
82
  | ------ | ------------------------------------------------- |
71
83
  | id | Limit results to user matching this guid |
@@ -20,12 +20,12 @@ Several environment variables are required for nacwrap to function.
20
20
  ### Instances - Create Instance
21
21
 
22
22
  Function to create a workflow instance. Takes in two parameters.
23
+
23
24
  | Param | Description |
24
25
  | ----------- | ----------------------------------------------------------------------------------------------------------------------------- |
25
26
  | workflow_id | The ID of the workflow you want to create an instance for. |
26
27
  | start_data | Optional, any start data the worklfow requires. Should be provided in dictionary format. Returns JSON response if successful. |
27
28
 
28
-
29
29
  ### Instances - List Instances
30
30
 
31
31
  Function to return instance data. Takes a number of parameters for filtering what instance data to get.
@@ -37,6 +37,7 @@ Make function to delegate tasks from one user to another.
37
37
  ### Tasks - Task Search
38
38
 
39
39
  Returns Nintex Tasks as a list of NintexTask objects. Takes a number of parameters for filtering what tasks to retrieve.
40
+
40
41
  | Param | Description |
41
42
  | ------------- | ----------------------------------------------------- |
42
43
  | workflow_name | Limit results to workflows matching this name. |
@@ -49,9 +50,10 @@ Returns Nintex Tasks as a list of NintexTask objects. Takes a number of paramete
49
50
  ### Users - List Users
50
51
 
51
52
  Returns Nintex Users as a list of NintexUser objects. Takes a number of parameters for filtering what users to retrieve.
53
+
52
54
  | Param | Description |
53
55
  | ------ | ------------------------------------------------- |
54
56
  | id | Limit results to user matching this guid |
55
57
  | email | Limit results to user matching this email |
56
58
  | filter | Limit results to user matching this email or name |
57
- | role | Limit results to users matching this role |
59
+ | role | Limit results to users matching this role |
@@ -0,0 +1,35 @@
1
+ import os
2
+
3
+ import requests
4
+
5
+ from nacwrap._auth import Decorators
6
+ from nacwrap._helpers import _basic_retry
7
+
8
+
9
+ @_basic_retry
10
+ @Decorators.refresh_token
11
+ def get_connections() -> list[dict]:
12
+ """
13
+ Get all connections
14
+ """
15
+ if "NINTEX_BASE_URL" not in os.environ:
16
+ raise Exception("NINTEX_BASE_URL not set")
17
+ try:
18
+ response = requests.get(
19
+ os.environ["NINTEX_BASE_URL"] + "/workflows/v1/connections",
20
+ headers={
21
+ "Authorization": f"Bearer {os.environ['NTX_BEARER_TOKEN']}",
22
+ },
23
+ timeout=30,
24
+ )
25
+ response.raise_for_status()
26
+ except requests.exceptions.HTTPError as e:
27
+ raise Exception(
28
+ f"Error getting connections: {e.response.status_code} - {e.response.content}"
29
+ )
30
+ except (requests.exceptions.ConnectionError, requests.exceptions.Timeout) as e:
31
+ raise
32
+ except requests.exceptions.RequestException as e:
33
+ raise Exception(f"Error getting connections: {e}")
34
+
35
+ return response.json().get("connections", [])
@@ -0,0 +1,68 @@
1
+ """
2
+ Also called data lookups in the Nintex interface.
3
+ """
4
+
5
+ import os
6
+
7
+ import requests
8
+
9
+ from nacwrap._auth import Decorators
10
+ from nacwrap._helpers import _basic_retry
11
+
12
+
13
+ @_basic_retry
14
+ @Decorators.refresh_token
15
+ def get_datasources() -> dict:
16
+ """
17
+ Get all data sources
18
+ """
19
+ if "NINTEX_BASE_URL" not in os.environ:
20
+ raise Exception("NINTEX_BASE_URL not set")
21
+ try:
22
+ response = requests.get(
23
+ os.environ["NINTEX_BASE_URL"] + "/workflows/v1/datasources",
24
+ headers={
25
+ "Authorization": f"Bearer {os.environ['NTX_BEARER_TOKEN']}",
26
+ },
27
+ timeout=30,
28
+ )
29
+ response.raise_for_status()
30
+ except requests.exceptions.HTTPError as e:
31
+ raise Exception(
32
+ f"Error getting data sources: {e.response.status_code} - {e.response.content}"
33
+ )
34
+ except (requests.exceptions.ConnectionError, requests.exceptions.Timeout) as e:
35
+ raise
36
+ except requests.exceptions.RequestException as e:
37
+ raise Exception(f"Error getting data sources: {e}")
38
+
39
+ return response.json().get("datasources", [])
40
+
41
+
42
+ @_basic_retry
43
+ @Decorators.refresh_token
44
+ def get_datasource_connectors() -> dict:
45
+ """
46
+ Get a list of connectors compatible with the xtensions data lookups
47
+ """
48
+ if "NINTEX_BASE_URL" not in os.environ:
49
+ raise Exception("NINTEX_BASE_URL not set")
50
+ try:
51
+ response = requests.get(
52
+ os.environ["NINTEX_BASE_URL"] + "/workflows/v1/datasources/contracts",
53
+ headers={
54
+ "Authorization": f"Bearer {os.environ['NTX_BEARER_TOKEN']}",
55
+ },
56
+ timeout=30,
57
+ )
58
+ response.raise_for_status()
59
+ except requests.exceptions.HTTPError as e:
60
+ raise Exception(
61
+ f"Error getting data source connectors: {e.response.status_code} - {e.response.content}"
62
+ )
63
+ except (requests.exceptions.ConnectionError, requests.exceptions.Timeout) as e:
64
+ raise
65
+ except requests.exceptions.RequestException as e:
66
+ raise Exception(f"Error getting data source connectors: {e}")
67
+
68
+ return response.json().get("contracts", [])
@@ -1,15 +1,21 @@
1
1
  import json
2
2
  import os
3
3
  from datetime import datetime
4
- from typing import Literal, Optional, Union
4
+ from typing import List, Literal, Optional, Union
5
5
 
6
6
  import requests
7
7
 
8
8
  from nacwrap._auth import Decorators
9
- from nacwrap._helpers import _fetch_page, _post
10
- from nacwrap.data_model import *
9
+ from nacwrap._helpers import _basic_retry, _fetch_page, _post
10
+ from nacwrap.data_model import (
11
+ InstanceActions,
12
+ InstanceStartData,
13
+ NintexInstance,
14
+ ResolveType,
15
+ )
11
16
 
12
17
 
18
+ @_basic_retry
13
19
  @Decorators.refresh_token
14
20
  def create_instance(workflow_id: str, start_data: Optional[dict] = None) -> dict:
15
21
  """
@@ -43,12 +49,15 @@ def create_instance(workflow_id: str, start_data: Optional[dict] = None) -> dict
43
49
  raise Exception(
44
50
  f"Error creating instance for {start_data}: {e.response.status_code} - {e.response.content}"
45
51
  )
52
+ except (requests.exceptions.Timeout, requests.exceptions.ConnectionError) as e:
53
+ raise
46
54
  except requests.exceptions.RequestException as e:
47
55
  raise Exception(f"Error creating instance for {start_data}: {e}")
48
56
 
49
57
  return response.json()
50
58
 
51
59
 
60
+ @_basic_retry
52
61
  @Decorators.refresh_token
53
62
  def instance_get(instanceId: str) -> dict:
54
63
  """
@@ -90,7 +99,8 @@ def instance_get(instanceId: str) -> dict:
90
99
  raise Exception(
91
100
  f"Error, could not get instance data: {e.response.status_code} - {e.response.content}"
92
101
  )
93
-
102
+ except (requests.exceptions.Timeout, requests.exceptions.ConnectionError) as e:
103
+ raise
94
104
  except requests.exceptions.RequestException as e:
95
105
  raise Exception(f"Error, could not get instance data: {e}")
96
106
 
@@ -184,7 +194,9 @@ def instances_list(
184
194
  "from": (
185
195
  from_datetime.strftime("%Y-%m-%dT%H:%M:%S.%fZ") if from_datetime else None
186
196
  ),
187
- "to": to_datetime.strftime("%Y-%m-%dT23:59:59.0000000Z") if to_datetime else None,
197
+ "to": to_datetime.strftime("%Y-%m-%dT23:59:59.0000000Z")
198
+ if to_datetime
199
+ else None,
188
200
  "pageSize": page_size,
189
201
  }
190
202
 
@@ -217,6 +229,8 @@ def instances_list(
217
229
  raise Exception(
218
230
  f"Error, could not get instance data: {e.response.status_code} - {e.response.content}"
219
231
  )
232
+ except (requests.exceptions.Timeout, requests.exceptions.ConnectionError) as e:
233
+ raise
220
234
  except requests.exceptions.RequestException as e:
221
235
  raise Exception(f"Error, could not get instance data: {e}")
222
236
 
@@ -2,9 +2,11 @@
2
2
  This module contains functions to interact with the Nintex Workflow Cloud API.
3
3
  """
4
4
 
5
+ from .connections import *
6
+ from .data_model import *
7
+ from .datasources import *
8
+ from .exceptions import *
5
9
  from .instances import *
6
10
  from .tasks import *
7
11
  from .users import *
8
- from .data_model import *
9
12
  from .workflows import *
10
- from .exceptions import *
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: nacwrap
3
- Version: 0.2.2
3
+ Version: 0.2.4
4
4
  Summary: Python package that acts as a wrapper for the Nintex Automation Cloud system.
5
5
  Home-page: https://github.com/pepsimidamerica/nacwrap
6
6
  Author: Jordan Maynor
@@ -14,6 +14,16 @@ License-File: LICENSE
14
14
  Requires-Dist: requests
15
15
  Requires-Dist: tenacity
16
16
  Requires-Dist: pydantic
17
+ Dynamic: author
18
+ Dynamic: author-email
19
+ Dynamic: classifier
20
+ Dynamic: description
21
+ Dynamic: description-content-type
22
+ Dynamic: home-page
23
+ Dynamic: license-file
24
+ Dynamic: requires-dist
25
+ Dynamic: requires-python
26
+ Dynamic: summary
17
27
 
18
28
  # Overview
19
29
 
@@ -37,12 +47,12 @@ Several environment variables are required for nacwrap to function.
37
47
  ### Instances - Create Instance
38
48
 
39
49
  Function to create a workflow instance. Takes in two parameters.
50
+
40
51
  | Param | Description |
41
52
  | ----------- | ----------------------------------------------------------------------------------------------------------------------------- |
42
53
  | workflow_id | The ID of the workflow you want to create an instance for. |
43
54
  | start_data | Optional, any start data the worklfow requires. Should be provided in dictionary format. Returns JSON response if successful. |
44
55
 
45
-
46
56
  ### Instances - List Instances
47
57
 
48
58
  Function to return instance data. Takes a number of parameters for filtering what instance data to get.
@@ -54,6 +64,7 @@ Make function to delegate tasks from one user to another.
54
64
  ### Tasks - Task Search
55
65
 
56
66
  Returns Nintex Tasks as a list of NintexTask objects. Takes a number of parameters for filtering what tasks to retrieve.
67
+
57
68
  | Param | Description |
58
69
  | ------------- | ----------------------------------------------------- |
59
70
  | workflow_name | Limit results to workflows matching this name. |
@@ -66,6 +77,7 @@ Returns Nintex Tasks as a list of NintexTask objects. Takes a number of paramete
66
77
  ### Users - List Users
67
78
 
68
79
  Returns Nintex Users as a list of NintexUser objects. Takes a number of parameters for filtering what users to retrieve.
80
+
69
81
  | Param | Description |
70
82
  | ------ | ------------------------------------------------- |
71
83
  | id | Limit results to user matching this guid |
@@ -8,7 +8,7 @@ with open("README.md", "r") as f:
8
8
 
9
9
  setup(
10
10
  name="nacwrap",
11
- version="0.2.02",
11
+ version="0.2.4",
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",
@@ -10,10 +10,10 @@ load_dotenv()
10
10
 
11
11
  sys.path.insert(0, "")
12
12
 
13
- from nacwrap import *
13
+ from nacwrap import nacwrap
14
14
 
15
- res = nacwrap.get_instance_data(
16
- "Sales Calls", status="Running", from_datetime=datetime.now() - timedelta(days=100)
17
- )
15
+ res = nacwrap.get_datasource_connectors()
16
+
17
+ pprint(res)
18
18
 
19
19
  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