anaplan-sdk 0.2.6__py3-none-any.whl → 0.2.8__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.
- anaplan_sdk/_async_clients/__init__.py +2 -1
- anaplan_sdk/_async_clients/_audit.py +9 -2
- anaplan_sdk/_async_clients/_bulk.py +13 -3
- anaplan_sdk/_clients/__init__.py +2 -1
- anaplan_sdk/_clients/_audit.py +8 -1
- anaplan_sdk/_clients/_bulk.py +8 -0
- {anaplan_sdk-0.2.6.dist-info → anaplan_sdk-0.2.8.dist-info}/METADATA +9 -8
- {anaplan_sdk-0.2.6.dist-info → anaplan_sdk-0.2.8.dist-info}/RECORD +10 -10
- {anaplan_sdk-0.2.6.dist-info → anaplan_sdk-0.2.8.dist-info}/WHEEL +0 -0
- {anaplan_sdk-0.2.6.dist-info → anaplan_sdk-0.2.8.dist-info}/licenses/LICENSE +0 -0
@@ -1,5 +1,6 @@
|
|
1
1
|
from ._alm import _AsyncAlmClient
|
2
|
+
from ._audit import _AsyncAuditClient
|
2
3
|
from ._bulk import AsyncClient
|
3
4
|
from ._transactional import _AsyncTransactionalClient
|
4
5
|
|
5
|
-
__all__ = ["_AsyncAlmClient", "
|
6
|
+
__all__ = ["AsyncClient", "_AsyncAlmClient", "_AsyncAuditClient", "_AsyncTransactionalClient"]
|
@@ -10,7 +10,7 @@ from anaplan_sdk._base import _AsyncBaseClient
|
|
10
10
|
Event = Literal["all", "byok", "user_activity"]
|
11
11
|
|
12
12
|
|
13
|
-
class
|
13
|
+
class _AsyncAuditClient(_AsyncBaseClient):
|
14
14
|
def __init__(self, client: httpx.AsyncClient, retry_count: int) -> None:
|
15
15
|
self._client = client
|
16
16
|
self._limit = 10_000
|
@@ -49,11 +49,18 @@ class _AuditClient(_AsyncBaseClient):
|
|
49
49
|
).get("response", [])
|
50
50
|
|
51
51
|
async def get_events(self, days_into_past: int = 30, event_type: Event = "all") -> list:
|
52
|
+
"""
|
53
|
+
Get audit events from Anaplan Audit API.
|
54
|
+
:param days_into_past: The nuber of days into the past to get events for. The API provides
|
55
|
+
data for up to 30 days.
|
56
|
+
:param event_type: The type of events to get.
|
57
|
+
:return: A list of audit events.
|
58
|
+
"""
|
52
59
|
total = await self._get_total(days_into_past, event_type)
|
53
60
|
if total == 0:
|
54
61
|
return []
|
55
62
|
if total <= 10_000:
|
56
|
-
return await self._get_result_page(
|
63
|
+
return await self._get_result_page(days_into_past, event_type)
|
57
64
|
|
58
65
|
return list(
|
59
66
|
chain.from_iterable(
|
@@ -17,7 +17,7 @@ from anaplan_sdk.exceptions import AnaplanActionError, InvalidIdentifierExceptio
|
|
17
17
|
from anaplan_sdk.models import Action, Export, File, Import, Model, Process, Workspace
|
18
18
|
|
19
19
|
from ._alm import _AsyncAlmClient
|
20
|
-
from ._audit import
|
20
|
+
from ._audit import _AsyncAuditClient
|
21
21
|
from ._transactional import _AsyncTransactionalClient
|
22
22
|
|
23
23
|
logging.getLogger("httpx").setLevel(logging.CRITICAL)
|
@@ -110,7 +110,7 @@ class AsyncClient(_AsyncBaseClient):
|
|
110
110
|
self._alm_client = (
|
111
111
|
_AsyncAlmClient(self._client, model_id, self._retry_count) if model_id else None
|
112
112
|
)
|
113
|
-
self.audit =
|
113
|
+
self.audit = _AsyncAuditClient(self._client, self._retry_count)
|
114
114
|
self.status_poll_delay = status_poll_delay
|
115
115
|
self.upload_chunk_size = upload_chunk_size
|
116
116
|
self.allow_file_creation = allow_file_creation
|
@@ -381,7 +381,7 @@ class AsyncClient(_AsyncBaseClient):
|
|
381
381
|
|
382
382
|
async def export_and_download(self, action_id: int) -> bytes:
|
383
383
|
"""
|
384
|
-
Convenience wrapper around `run_action()`
|
384
|
+
Convenience wrapper around `run_action()` and `get_file()` to run an export action and
|
385
385
|
download the exported content in one call.
|
386
386
|
:param action_id: The identifier of the action to run.
|
387
387
|
:return: The content of the exported file.
|
@@ -389,6 +389,16 @@ class AsyncClient(_AsyncBaseClient):
|
|
389
389
|
await self.run_action(action_id)
|
390
390
|
return await self.get_file(action_id)
|
391
391
|
|
392
|
+
async def list_task_status(self, action_id: int) -> list:
|
393
|
+
"""
|
394
|
+
Retrieves the status of all tasks spawned by the specified action.
|
395
|
+
:param action_id: The identifier of the action that was invoked.
|
396
|
+
:return: The list of tasks spawned by the action.
|
397
|
+
"""
|
398
|
+
return (await self._get(f"{self._url}/{action_url(action_id)}/{action_id}/tasks")).get(
|
399
|
+
"tasks", []
|
400
|
+
)
|
401
|
+
|
392
402
|
async def get_task_status(
|
393
403
|
self, action_id: int, task_id: str
|
394
404
|
) -> dict[str, float | int | str | list | dict | bool]:
|
anaplan_sdk/_clients/__init__.py
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
from ._alm import _AlmClient
|
2
|
+
from ._audit import _AuditClient
|
2
3
|
from ._bulk import Client
|
3
4
|
from ._transactional import _TransactionalClient
|
4
5
|
|
5
|
-
__all__ = ["_AlmClient", "
|
6
|
+
__all__ = ["Client", "_AlmClient", "_AuditClient", "_TransactionalClient"]
|
anaplan_sdk/_clients/_audit.py
CHANGED
@@ -49,11 +49,18 @@ class _AuditClient(_BaseClient):
|
|
49
49
|
).get("response", [])
|
50
50
|
|
51
51
|
def get_events(self, days_into_past: int = 30, event_type: Event = "all") -> list:
|
52
|
+
"""
|
53
|
+
Get audit events from Anaplan Audit API.
|
54
|
+
:param days_into_past: The nuber of days into the past to get events for. The API provides
|
55
|
+
data for up to 30 days.
|
56
|
+
:param event_type: The type of events to get.
|
57
|
+
:return: A list of audit events.
|
58
|
+
"""
|
52
59
|
total = self._get_total(days_into_past, event_type)
|
53
60
|
if total == 0:
|
54
61
|
return []
|
55
62
|
if total <= 10_000:
|
56
|
-
return self._get_result_page(
|
63
|
+
return self._get_result_page(days_into_past, event_type)
|
57
64
|
|
58
65
|
from concurrent.futures import ThreadPoolExecutor
|
59
66
|
|
anaplan_sdk/_clients/_bulk.py
CHANGED
@@ -382,6 +382,14 @@ class Client(_BaseClient):
|
|
382
382
|
self.run_action(action_id)
|
383
383
|
return self.get_file(action_id)
|
384
384
|
|
385
|
+
def list_task_status(self, action_id: int) -> list:
|
386
|
+
"""
|
387
|
+
Retrieves the status of all tasks spawned by the specified action.
|
388
|
+
:param action_id: The identifier of the action that was invoked.
|
389
|
+
:return: The list of tasks spawned by the action.
|
390
|
+
"""
|
391
|
+
return self._get(f"{self._url}/{action_url(action_id)}/{action_id}/tasks").get("tasks", [])
|
392
|
+
|
385
393
|
def get_task_status(
|
386
394
|
self, action_id: int, task_id: str
|
387
395
|
) -> dict[str, float | int | str | list | dict | bool]:
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: anaplan-sdk
|
3
|
-
Version: 0.2.
|
3
|
+
Version: 0.2.8
|
4
4
|
Summary: Provides pythonic access to the Anaplan API
|
5
5
|
Project-URL: Homepage, https://vinzenzklass.github.io/anaplan-sdk/
|
6
6
|
Project-URL: Repository, https://github.com/VinzenzKlass/anaplan-sdk
|
@@ -22,6 +22,7 @@ Description-Content-Type: text/markdown
|
|
22
22
|
<h1 align="center" style="font-size: 3rem; font-weight: 400; margin: -15px 0">
|
23
23
|
Anaplan SDK
|
24
24
|
</h1>
|
25
|
+
|
25
26
|
<p align="center" style="margin-top: 15px">
|
26
27
|
<a href="https://pepy.tech/project/anaplan-sdk">
|
27
28
|
<img align="center" src="https://static.pepy.tech/badge/anaplan-sdk/month" alt="Downloads Badge"/>
|
@@ -30,15 +31,15 @@ Anaplan SDK
|
|
30
31
|
|
31
32
|
---
|
32
33
|
|
33
|
-
Anaplan SDK is an independent, unofficial project providing pythonic access to
|
34
|
-
the
|
35
|
-
|
36
|
-
Requests, Authentication, JSON Parsing, Compression, Chunking and so on.
|
34
|
+
Anaplan SDK is an independent, unofficial project providing pythonic access to Anaplan. Anaplan SDK provides high-level
|
35
|
+
abstractions over the various Anaplan APIs, so you can focus on you requirements rather than spend time on
|
36
|
+
implementation details like authentication, error handling, chunking, compression and data formatting.
|
37
37
|
|
38
38
|
This Projects supports
|
39
|
-
the [Bulk
|
40
|
-
the [Transactional
|
41
|
-
the [ALM
|
39
|
+
the [Bulk APIs](https://help.anaplan.com/use-the-bulk-apis-93218e5e-00e5-406e-8361-09ab861889a7),
|
40
|
+
the [Transactional APIs](https://help.anaplan.com/use-the-transactional-apis-cc1c1e91-39fc-4272-a4b5-16bc91e9c313) and
|
41
|
+
the [ALM APsI](https://help.anaplan.com/application-lifecycle-management-api-2565cfa6-e0c2-4e24-884e-d0df957184d6),
|
42
|
+
the [Audit APIs](https://auditservice.docs.apiary.io/#),
|
42
43
|
providing both synchronous and asynchronous Clients.
|
43
44
|
|
44
45
|
Visit [Anaplan SDK](https://vinzenzklass.github.io/anaplan-sdk/) for documentation.
|
@@ -3,17 +3,17 @@ anaplan_sdk/_auth.py,sha256=wRcMpdDiHuV-dtiGAKElDiwzfZAEeTOFWfSfaLwNPoU,6597
|
|
3
3
|
anaplan_sdk/_base.py,sha256=2Te7rg_o8_1KD64NfKsDiPLladaoDxMuzk0PaAUNSr8,5299
|
4
4
|
anaplan_sdk/exceptions.py,sha256=ALkA9fBF0NQ7dufFxV6AivjmHyuJk9DOQ9jtJV2n7f0,1809
|
5
5
|
anaplan_sdk/models.py,sha256=ceMaVctpjwQHk7a71Io_-1YcCQshx5i1YYnqxS51nYw,12491
|
6
|
-
anaplan_sdk/_async_clients/__init__.py,sha256=
|
6
|
+
anaplan_sdk/_async_clients/__init__.py,sha256=wT6qfi4f_4vLFWTJQTsBw8r3DrHtoTIVqi88p5_j-Cg,259
|
7
7
|
anaplan_sdk/_async_clients/_alm.py,sha256=-sFk91tRihc5GVPlW41-I5sQ0fxSRCSYTop5S4q2lHc,3673
|
8
|
-
anaplan_sdk/_async_clients/_audit.py,sha256=
|
9
|
-
anaplan_sdk/_async_clients/_bulk.py,sha256=
|
8
|
+
anaplan_sdk/_async_clients/_audit.py,sha256=seCaB3wm_RXeO1CPUhzJwR0OxkS_iAwgrAWnLXAAb9M,2521
|
9
|
+
anaplan_sdk/_async_clients/_bulk.py,sha256=JmjvZKuekHQceBmItexhkk9YT6njg5_gsYLdtGCyWzE,22202
|
10
10
|
anaplan_sdk/_async_clients/_transactional.py,sha256=wX_1U5YS4uwrr8D8MfNkfeA-ylFERMb-6xvewG799xY,4961
|
11
|
-
anaplan_sdk/_clients/__init__.py,sha256=
|
11
|
+
anaplan_sdk/_clients/__init__.py,sha256=FsbwvZC1FHrxuRXwbPxUzbhz_lO1DpXIxEOjx6-3QuA,219
|
12
12
|
anaplan_sdk/_clients/_alm.py,sha256=Vcrn3TjHlH365O7F1TKc1WiZWURNqQf_gSc8UUVESM8,3564
|
13
|
-
anaplan_sdk/_clients/_audit.py,sha256=
|
14
|
-
anaplan_sdk/_clients/_bulk.py,sha256=
|
13
|
+
anaplan_sdk/_clients/_audit.py,sha256=08CIBaxL8g6s6s0kpuA9_pxJpwRxxJrAjI9lQE3YgqE,2596
|
14
|
+
anaplan_sdk/_clients/_bulk.py,sha256=_rhp7MgcIRq0FYwxEzvU7jBkDm5PQaw9YCU_zqIwauY,22222
|
15
15
|
anaplan_sdk/_clients/_transactional.py,sha256=4NYhq2HdxNh4K-HqMyYoyAEqKih2eTtFiXDZi8xOaf8,4695
|
16
|
-
anaplan_sdk-0.2.
|
17
|
-
anaplan_sdk-0.2.
|
18
|
-
anaplan_sdk-0.2.
|
19
|
-
anaplan_sdk-0.2.
|
16
|
+
anaplan_sdk-0.2.8.dist-info/METADATA,sha256=ay8eF31erA7KFU96IPNLfhgw_BUNvU8Ua5wGQyqL0yU,3602
|
17
|
+
anaplan_sdk-0.2.8.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
18
|
+
anaplan_sdk-0.2.8.dist-info/licenses/LICENSE,sha256=HrhfyXIkWY2tGFK11kg7vPCqhgh5DcxleloqdhrpyMY,11558
|
19
|
+
anaplan_sdk-0.2.8.dist-info/RECORD,,
|
File without changes
|
File without changes
|