anaplan-sdk 0.2.7__tar.gz → 0.2.9__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.
- {anaplan_sdk-0.2.7 → anaplan_sdk-0.2.9}/PKG-INFO +11 -10
- {anaplan_sdk-0.2.7 → anaplan_sdk-0.2.9}/README.md +8 -7
- {anaplan_sdk-0.2.7 → anaplan_sdk-0.2.9}/anaplan_sdk/_async_clients/_alm.py +10 -0
- {anaplan_sdk-0.2.7 → anaplan_sdk-0.2.9}/anaplan_sdk/_async_clients/_audit.py +38 -20
- {anaplan_sdk-0.2.7 → anaplan_sdk-0.2.9}/anaplan_sdk/_clients/_alm.py +10 -0
- {anaplan_sdk-0.2.7 → anaplan_sdk-0.2.9}/anaplan_sdk/_clients/_audit.py +37 -19
- {anaplan_sdk-0.2.7 → anaplan_sdk-0.2.9}/docs/api/async_audit_client.md +1 -1
- {anaplan_sdk-0.2.7 → anaplan_sdk-0.2.9}/docs/api/audit_client.md +1 -1
- anaplan_sdk-0.2.9/docs/guides/audit.md +81 -0
- {anaplan_sdk-0.2.7 → anaplan_sdk-0.2.9}/pyproject.toml +3 -3
- {anaplan_sdk-0.2.7 → anaplan_sdk-0.2.9}/uv.lock +1 -1
- anaplan_sdk-0.2.7/docs/guides/audit.md +0 -42
- {anaplan_sdk-0.2.7 → anaplan_sdk-0.2.9}/.github/dependabot.yml +0 -0
- {anaplan_sdk-0.2.7 → anaplan_sdk-0.2.9}/.github/workflows/docs.yml +0 -0
- {anaplan_sdk-0.2.7 → anaplan_sdk-0.2.9}/.github/workflows/lint.yml +0 -0
- {anaplan_sdk-0.2.7 → anaplan_sdk-0.2.9}/.github/workflows/tests.yml +0 -0
- {anaplan_sdk-0.2.7 → anaplan_sdk-0.2.9}/.gitignore +0 -0
- {anaplan_sdk-0.2.7 → anaplan_sdk-0.2.9}/.pre-commit-config.yaml +0 -0
- {anaplan_sdk-0.2.7 → anaplan_sdk-0.2.9}/LICENSE +0 -0
- {anaplan_sdk-0.2.7 → anaplan_sdk-0.2.9}/anaplan_sdk/__init__.py +0 -0
- {anaplan_sdk-0.2.7 → anaplan_sdk-0.2.9}/anaplan_sdk/_async_clients/__init__.py +0 -0
- {anaplan_sdk-0.2.7 → anaplan_sdk-0.2.9}/anaplan_sdk/_async_clients/_bulk.py +0 -0
- {anaplan_sdk-0.2.7 → anaplan_sdk-0.2.9}/anaplan_sdk/_async_clients/_transactional.py +0 -0
- {anaplan_sdk-0.2.7 → anaplan_sdk-0.2.9}/anaplan_sdk/_auth.py +0 -0
- {anaplan_sdk-0.2.7 → anaplan_sdk-0.2.9}/anaplan_sdk/_base.py +0 -0
- {anaplan_sdk-0.2.7 → anaplan_sdk-0.2.9}/anaplan_sdk/_clients/__init__.py +0 -0
- {anaplan_sdk-0.2.7 → anaplan_sdk-0.2.9}/anaplan_sdk/_clients/_bulk.py +0 -0
- {anaplan_sdk-0.2.7 → anaplan_sdk-0.2.9}/anaplan_sdk/_clients/_transactional.py +0 -0
- {anaplan_sdk-0.2.7 → anaplan_sdk-0.2.9}/anaplan_sdk/exceptions.py +0 -0
- {anaplan_sdk-0.2.7 → anaplan_sdk-0.2.9}/anaplan_sdk/models.py +0 -0
- {anaplan_sdk-0.2.7 → anaplan_sdk-0.2.9}/docs/anaplan_explained.md +0 -0
- {anaplan_sdk-0.2.7 → anaplan_sdk-0.2.9}/docs/api/alm_client.md +0 -0
- {anaplan_sdk-0.2.7 → anaplan_sdk-0.2.9}/docs/api/async_alm_client.md +0 -0
- {anaplan_sdk-0.2.7 → anaplan_sdk-0.2.9}/docs/api/async_client.md +0 -0
- {anaplan_sdk-0.2.7 → anaplan_sdk-0.2.9}/docs/api/async_transactional_client.md +0 -0
- {anaplan_sdk-0.2.7 → anaplan_sdk-0.2.9}/docs/api/client.md +0 -0
- {anaplan_sdk-0.2.7 → anaplan_sdk-0.2.9}/docs/api/exceptions.md +0 -0
- {anaplan_sdk-0.2.7 → anaplan_sdk-0.2.9}/docs/api/models.md +0 -0
- {anaplan_sdk-0.2.7 → anaplan_sdk-0.2.9}/docs/api/transactional_client.md +0 -0
- {anaplan_sdk-0.2.7 → anaplan_sdk-0.2.9}/docs/css/styles.css +0 -0
- {anaplan_sdk-0.2.7 → anaplan_sdk-0.2.9}/docs/guides/alm.md +0 -0
- {anaplan_sdk-0.2.7 → anaplan_sdk-0.2.9}/docs/guides/bulk.md +0 -0
- {anaplan_sdk-0.2.7 → anaplan_sdk-0.2.9}/docs/guides/bulk_vs_transactional.md +0 -0
- {anaplan_sdk-0.2.7 → anaplan_sdk-0.2.9}/docs/guides/logging.md +0 -0
- {anaplan_sdk-0.2.7 → anaplan_sdk-0.2.9}/docs/guides/multiple_models.md +0 -0
- {anaplan_sdk-0.2.7 → anaplan_sdk-0.2.9}/docs/guides/transactional.md +0 -0
- {anaplan_sdk-0.2.7 → anaplan_sdk-0.2.9}/docs/img/anaplan-overview.webp +0 -0
- {anaplan_sdk-0.2.7 → anaplan_sdk-0.2.9}/docs/img/anaplan-sdk.webp +0 -0
- {anaplan_sdk-0.2.7 → anaplan_sdk-0.2.9}/docs/index.md +0 -0
- {anaplan_sdk-0.2.7 → anaplan_sdk-0.2.9}/docs/installation.md +0 -0
- {anaplan_sdk-0.2.7 → anaplan_sdk-0.2.9}/docs/quickstart.md +0 -0
- {anaplan_sdk-0.2.7 → anaplan_sdk-0.2.9}/mkdocs.yml +0 -0
- {anaplan_sdk-0.2.7 → anaplan_sdk-0.2.9}/tests/test_alm_client.py +0 -0
- {anaplan_sdk-0.2.7 → anaplan_sdk-0.2.9}/tests/test_async_alm_client.py +0 -0
- {anaplan_sdk-0.2.7 → anaplan_sdk-0.2.9}/tests/test_async_client.py +0 -0
- {anaplan_sdk-0.2.7 → anaplan_sdk-0.2.9}/tests/test_async_transactional_client.py +0 -0
- {anaplan_sdk-0.2.7 → anaplan_sdk-0.2.9}/tests/test_client.py +0 -0
- {anaplan_sdk-0.2.7 → anaplan_sdk-0.2.9}/tests/test_transactional_client.py +0 -0
@@ -1,14 +1,14 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: anaplan-sdk
|
3
|
-
Version: 0.2.
|
3
|
+
Version: 0.2.9
|
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
|
7
7
|
Project-URL: Documentation, https://vinzenzklass.github.io/anaplan-sdk/
|
8
|
-
Author-email: Vinzenz Klass <vinzenz.klass@
|
8
|
+
Author-email: Vinzenz Klass <vinzenz.klass@valantic.com>
|
9
9
|
License-Expression: Apache-2.0
|
10
10
|
License-File: LICENSE
|
11
|
-
Keywords: anaplan,anaplan alm api,anaplan api,anaplan bulk api,anaplan integration
|
11
|
+
Keywords: anaplan,anaplan alm api,anaplan api,anaplan audit api,anaplan bulk api,anaplan integration
|
12
12
|
Requires-Python: >=3.10.4
|
13
13
|
Requires-Dist: cryptography<45.0.0,>=42.0.7
|
14
14
|
Requires-Dist: httpx<1.0.0,>=0.27.0
|
@@ -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.
|
@@ -5,6 +5,7 @@
|
|
5
5
|
<h1 align="center" style="font-size: 3rem; font-weight: 400; margin: -15px 0">
|
6
6
|
Anaplan SDK
|
7
7
|
</h1>
|
8
|
+
|
8
9
|
<p align="center" style="margin-top: 15px">
|
9
10
|
<a href="https://pepy.tech/project/anaplan-sdk">
|
10
11
|
<img align="center" src="https://static.pepy.tech/badge/anaplan-sdk/month" alt="Downloads Badge"/>
|
@@ -13,15 +14,15 @@ Anaplan SDK
|
|
13
14
|
|
14
15
|
---
|
15
16
|
|
16
|
-
Anaplan SDK is an independent, unofficial project providing pythonic access to
|
17
|
-
the
|
18
|
-
|
19
|
-
Requests, Authentication, JSON Parsing, Compression, Chunking and so on.
|
17
|
+
Anaplan SDK is an independent, unofficial project providing pythonic access to Anaplan. Anaplan SDK provides high-level
|
18
|
+
abstractions over the various Anaplan APIs, so you can focus on you requirements rather than spend time on
|
19
|
+
implementation details like authentication, error handling, chunking, compression and data formatting.
|
20
20
|
|
21
21
|
This Projects supports
|
22
|
-
the [Bulk
|
23
|
-
the [Transactional
|
24
|
-
the [ALM
|
22
|
+
the [Bulk APIs](https://help.anaplan.com/use-the-bulk-apis-93218e5e-00e5-406e-8361-09ab861889a7),
|
23
|
+
the [Transactional APIs](https://help.anaplan.com/use-the-transactional-apis-cc1c1e91-39fc-4272-a4b5-16bc91e9c313) and
|
24
|
+
the [ALM APsI](https://help.anaplan.com/application-lifecycle-management-api-2565cfa6-e0c2-4e24-884e-d0df957184d6),
|
25
|
+
the [Audit APIs](https://auditservice.docs.apiary.io/#),
|
25
26
|
providing both synchronous and asynchronous Clients.
|
26
27
|
|
27
28
|
Visit [Anaplan SDK](https://vinzenzklass.github.io/anaplan-sdk/) for documentation.
|
@@ -1,8 +1,12 @@
|
|
1
|
+
import warnings
|
2
|
+
|
1
3
|
import httpx
|
2
4
|
|
3
5
|
from anaplan_sdk._base import _AsyncBaseClient
|
4
6
|
from anaplan_sdk.models import ModelRevision, Revision, SyncTask, User
|
5
7
|
|
8
|
+
warnings.filterwarnings("always", category=DeprecationWarning)
|
9
|
+
|
6
10
|
|
7
11
|
class _AsyncAlmClient(_AsyncBaseClient):
|
8
12
|
def __init__(self, client: httpx.AsyncClient, model_id: str, retry_count: int) -> None:
|
@@ -15,6 +19,12 @@ class _AsyncAlmClient(_AsyncBaseClient):
|
|
15
19
|
Lists all the Users in the authenticated users default tenant.
|
16
20
|
:return: The List of Users.
|
17
21
|
"""
|
22
|
+
warnings.warn(
|
23
|
+
"`list_users()` on the ALM client is deprecated and will be removed in a "
|
24
|
+
"future version. Use `list_users()` on the Audit client instead.",
|
25
|
+
DeprecationWarning,
|
26
|
+
stacklevel=1,
|
27
|
+
)
|
18
28
|
return [
|
19
29
|
User.model_validate(e)
|
20
30
|
for e in (await self._get("https://api.anaplan.com/2/0/users")).get("users")
|
@@ -6,6 +6,7 @@ from typing import Literal
|
|
6
6
|
import httpx
|
7
7
|
|
8
8
|
from anaplan_sdk._base import _AsyncBaseClient
|
9
|
+
from anaplan_sdk.models import User
|
9
10
|
|
10
11
|
Event = Literal["all", "byok", "user_activity"]
|
11
12
|
|
@@ -17,6 +18,43 @@ class _AsyncAuditClient(_AsyncBaseClient):
|
|
17
18
|
self._url = "https://audit.anaplan.com/audit/api/1/events"
|
18
19
|
super().__init__(retry_count, client)
|
19
20
|
|
21
|
+
async def list_users(self) -> list[User]:
|
22
|
+
"""
|
23
|
+
Lists all the Users in the authenticated users default tenant.
|
24
|
+
:return: The List of Users.
|
25
|
+
"""
|
26
|
+
return [
|
27
|
+
User.model_validate(e)
|
28
|
+
for e in (await self._get("https://api.anaplan.com/2/0/users")).get("users")
|
29
|
+
]
|
30
|
+
|
31
|
+
async def get_events(self, days_into_past: int = 30, event_type: Event = "all") -> list:
|
32
|
+
"""
|
33
|
+
Get audit events from Anaplan Audit API.
|
34
|
+
:param days_into_past: The nuber of days into the past to get events for. The API provides
|
35
|
+
data for up to 30 days.
|
36
|
+
:param event_type: The type of events to get.
|
37
|
+
:return: A list of audit events.
|
38
|
+
"""
|
39
|
+
total = await self._get_total(days_into_past, event_type)
|
40
|
+
if total == 0:
|
41
|
+
return []
|
42
|
+
if total <= 10_000:
|
43
|
+
return await self._get_result_page(days_into_past, event_type)
|
44
|
+
|
45
|
+
return list(
|
46
|
+
chain.from_iterable(
|
47
|
+
await gather(
|
48
|
+
*(
|
49
|
+
self._get_result_page(
|
50
|
+
days_into_past, event_type, self._limit, n * self._limit
|
51
|
+
)
|
52
|
+
for n in range(ceil(total / self._limit))
|
53
|
+
)
|
54
|
+
)
|
55
|
+
)
|
56
|
+
)
|
57
|
+
|
20
58
|
async def _get_total(self, days_into_past: int = 60, event_type: Event = "all") -> int:
|
21
59
|
return ( # noqa
|
22
60
|
await self._get(
|
@@ -47,23 +85,3 @@ class _AsyncAuditClient(_AsyncBaseClient):
|
|
47
85
|
},
|
48
86
|
)
|
49
87
|
).get("response", [])
|
50
|
-
|
51
|
-
async def get_events(self, days_into_past: int = 30, event_type: Event = "all") -> list:
|
52
|
-
total = await self._get_total(days_into_past, event_type)
|
53
|
-
if total == 0:
|
54
|
-
return []
|
55
|
-
if total <= 10_000:
|
56
|
-
return await self._get_result_page(total)
|
57
|
-
|
58
|
-
return list(
|
59
|
-
chain.from_iterable(
|
60
|
-
await gather(
|
61
|
-
*(
|
62
|
-
self._get_result_page(
|
63
|
-
days_into_past, event_type, self._limit, n * self._limit
|
64
|
-
)
|
65
|
-
for n in range(ceil(total / self._limit))
|
66
|
-
)
|
67
|
-
)
|
68
|
-
)
|
69
|
-
)
|
@@ -1,8 +1,12 @@
|
|
1
|
+
import warnings
|
2
|
+
|
1
3
|
import httpx
|
2
4
|
|
3
5
|
from anaplan_sdk._base import _BaseClient
|
4
6
|
from anaplan_sdk.models import ModelRevision, Revision, SyncTask, User
|
5
7
|
|
8
|
+
warnings.filterwarnings("always", category=DeprecationWarning)
|
9
|
+
|
6
10
|
|
7
11
|
class _AlmClient(_BaseClient):
|
8
12
|
def __init__(self, client: httpx.Client, model_id: str, retry_count: int) -> None:
|
@@ -15,6 +19,12 @@ class _AlmClient(_BaseClient):
|
|
15
19
|
Lists all the Users in the authenticated users default tenant.
|
16
20
|
:return: The List of Users.
|
17
21
|
"""
|
22
|
+
warnings.warn(
|
23
|
+
"`list_users()` on the ALM client is deprecated and will be removed in a "
|
24
|
+
"future version. Use `list_users()` on the Audit client instead.",
|
25
|
+
DeprecationWarning,
|
26
|
+
stacklevel=1,
|
27
|
+
)
|
18
28
|
return [
|
19
29
|
User.model_validate(e)
|
20
30
|
for e in self._get("https://api.anaplan.com/2/0/users").get("users")
|
@@ -5,6 +5,7 @@ from typing import Literal
|
|
5
5
|
import httpx
|
6
6
|
|
7
7
|
from anaplan_sdk._base import _BaseClient
|
8
|
+
from anaplan_sdk.models import User
|
8
9
|
|
9
10
|
Event = Literal["all", "byok", "user_activity"]
|
10
11
|
|
@@ -17,6 +18,42 @@ class _AuditClient(_BaseClient):
|
|
17
18
|
self._url = "https://audit.anaplan.com/audit/api/1/events"
|
18
19
|
super().__init__(retry_count, client)
|
19
20
|
|
21
|
+
def list_users(self) -> list[User]:
|
22
|
+
"""
|
23
|
+
Lists all the Users in the authenticated users default tenant.
|
24
|
+
:return: The List of Users.
|
25
|
+
"""
|
26
|
+
return [
|
27
|
+
User.model_validate(e)
|
28
|
+
for e in self._get("https://api.anaplan.com/2/0/users").get("users")
|
29
|
+
]
|
30
|
+
|
31
|
+
def get_events(self, days_into_past: int = 30, event_type: Event = "all") -> list:
|
32
|
+
"""
|
33
|
+
Get audit events from Anaplan Audit API.
|
34
|
+
:param days_into_past: The nuber of days into the past to get events for. The API provides
|
35
|
+
data for up to 30 days.
|
36
|
+
:param event_type: The type of events to get.
|
37
|
+
:return: A list of audit events.
|
38
|
+
"""
|
39
|
+
total = self._get_total(days_into_past, event_type)
|
40
|
+
if total == 0:
|
41
|
+
return []
|
42
|
+
if total <= 10_000:
|
43
|
+
return self._get_result_page(days_into_past, event_type)
|
44
|
+
|
45
|
+
from concurrent.futures import ThreadPoolExecutor
|
46
|
+
|
47
|
+
with ThreadPoolExecutor(max_workers=self._thread_count) as executor:
|
48
|
+
futures = [
|
49
|
+
executor.submit(
|
50
|
+
self._get_result_page, days_into_past, event_type, self._limit, n * self._limit
|
51
|
+
)
|
52
|
+
for n in range(ceil(total / self._limit))
|
53
|
+
]
|
54
|
+
results = [future.result() for future in futures]
|
55
|
+
return list(chain.from_iterable(results))
|
56
|
+
|
20
57
|
def _get_total(self, days_into_past: int = 60, event_type: Event = "all") -> int:
|
21
58
|
return ( # noqa
|
22
59
|
self._get(
|
@@ -47,22 +84,3 @@ class _AuditClient(_BaseClient):
|
|
47
84
|
},
|
48
85
|
)
|
49
86
|
).get("response", [])
|
50
|
-
|
51
|
-
def get_events(self, days_into_past: int = 30, event_type: Event = "all") -> list:
|
52
|
-
total = self._get_total(days_into_past, event_type)
|
53
|
-
if total == 0:
|
54
|
-
return []
|
55
|
-
if total <= 10_000:
|
56
|
-
return self._get_result_page(total)
|
57
|
-
|
58
|
-
from concurrent.futures import ThreadPoolExecutor
|
59
|
-
|
60
|
-
with ThreadPoolExecutor(max_workers=self._thread_count) as executor:
|
61
|
-
futures = [
|
62
|
-
executor.submit(
|
63
|
-
self._get_result_page, days_into_past, event_type, self._limit, n * self._limit
|
64
|
-
)
|
65
|
-
for n in range(ceil(total / self._limit))
|
66
|
-
]
|
67
|
-
results = [future.result() for future in futures]
|
68
|
-
return list(chain.from_iterable(results))
|
@@ -2,4 +2,4 @@
|
|
2
2
|
This Class is not meant to be instantiated directly, but rather accessed through the `audit` Property on an
|
3
3
|
instance of [Client](client.md). For more details, see the [Guide](../guides/audit.md).
|
4
4
|
|
5
|
-
::: anaplan_sdk._async_clients.
|
5
|
+
::: anaplan_sdk._async_clients._AsyncAuditClient
|
@@ -2,4 +2,4 @@
|
|
2
2
|
This Class is not meant to be instantiated directly, but rather accessed through the `audit` Property on an
|
3
3
|
instance of [Client](client.md). For more details, see the [Guide](../guides/audit.md).
|
4
4
|
|
5
|
-
::: anaplan_sdk._clients.
|
5
|
+
::: anaplan_sdk._clients._AuditClient
|
@@ -0,0 +1,81 @@
|
|
1
|
+
You can use the Audit API to get fine-grained information about the changes made to any model, usage, user sign-ins,
|
2
|
+
most frequently visited pages and much more. The Audit API exposes most the logs collected by Anaplan.
|
3
|
+
|
4
|
+
For API details refer to
|
5
|
+
[the Documentation](https://auditservice.docs.apiary.io/#).
|
6
|
+
|
7
|
+
## Usage
|
8
|
+
|
9
|
+
!!! tip "Tenant Level API"
|
10
|
+
Note the absence of `workspace_id` and `model_id` in the Audit API. The Audit API is a tenant level API, meaning it
|
11
|
+
is not scoped to a specific workspace or model. You can use the Audit API to get information about all workspaces and
|
12
|
+
models for the default tenant of the user you are providing the credentials for.
|
13
|
+
|
14
|
+
The methods for the Audit API reside in a different namespace for better API navigability and
|
15
|
+
comprehensiveness, but are accessible through the same client for convenience. For e.g., you can call
|
16
|
+
the `.get_events()` method like so:
|
17
|
+
|
18
|
+
/// tab | Synchronous
|
19
|
+
|
20
|
+
```python
|
21
|
+
import anaplan_sdk
|
22
|
+
|
23
|
+
anaplan = anaplan_sdk.Client(
|
24
|
+
certificate="~/certs/anaplan.pem", private_key="~/keys/anaplan.pem"
|
25
|
+
)
|
26
|
+
events = anaplan.audit.get_events()
|
27
|
+
```
|
28
|
+
|
29
|
+
///
|
30
|
+
/// tab | Asynchronous
|
31
|
+
|
32
|
+
```python
|
33
|
+
import anaplan_sdk
|
34
|
+
|
35
|
+
anaplan = anaplan_sdk.AsyncClient(
|
36
|
+
certificate="~/certs/anaplan.pem", private_key="~/keys/anaplan.pem"
|
37
|
+
)
|
38
|
+
events = await anaplan.audit.get_events()
|
39
|
+
```
|
40
|
+
|
41
|
+
///
|
42
|
+
|
43
|
+
The Audit API also exposes the `list_users()` method to get a list of all users in the workspace. You can for e.g. use
|
44
|
+
the two methods in combination to get a list of events with the username using [polars](https://docs.pola.rs):
|
45
|
+
|
46
|
+
/// tab | Synchronous
|
47
|
+
|
48
|
+
```python
|
49
|
+
import polars as pl
|
50
|
+
|
51
|
+
events, users = anaplan.audit.get_events(14), anaplan.audit.list_users()
|
52
|
+
df = pl.DataFrame(events, orient="row", infer_schema_length=1_000).join(
|
53
|
+
pl.DataFrame(users, orient="row").select(
|
54
|
+
pl.col("id").alias("userId"), "first_name", "last_name"
|
55
|
+
),
|
56
|
+
on="userId",
|
57
|
+
how="left",
|
58
|
+
)
|
59
|
+
```
|
60
|
+
|
61
|
+
///
|
62
|
+
/// tab | Asynchronous
|
63
|
+
|
64
|
+
```python
|
65
|
+
import polars as pl
|
66
|
+
|
67
|
+
events, users = await gather(
|
68
|
+
anaplan.audit.get_events(14), anaplan.audit.list_users()
|
69
|
+
)
|
70
|
+
df = pl.DataFrame(events, orient="row", infer_schema_length=1_000).join(
|
71
|
+
pl.DataFrame(users, orient="row").select(
|
72
|
+
pl.col("id").alias("userId"), "first_name", "last_name"
|
73
|
+
),
|
74
|
+
on="userId",
|
75
|
+
how="left",
|
76
|
+
)
|
77
|
+
```
|
78
|
+
|
79
|
+
///
|
80
|
+
|
81
|
+
|
@@ -1,11 +1,11 @@
|
|
1
1
|
[project]
|
2
2
|
name = "anaplan-sdk"
|
3
|
-
version = "0.2.
|
3
|
+
version = "0.2.9"
|
4
4
|
description = "Provides pythonic access to the Anaplan API"
|
5
5
|
license = "Apache-2.0"
|
6
|
-
authors = [{ name = "Vinzenz Klass", email = "vinzenz.klass@
|
6
|
+
authors = [{ name = "Vinzenz Klass", email = "vinzenz.klass@valantic.com" }]
|
7
7
|
readme = "README.md"
|
8
|
-
keywords = ["anaplan", "anaplan api", "anaplan bulk api", "anaplan integration", "anaplan alm api"]
|
8
|
+
keywords = ["anaplan", "anaplan api", "anaplan bulk api", "anaplan integration", "anaplan alm api", "anaplan audit api"]
|
9
9
|
requires-python = ">=3.10.4"
|
10
10
|
dependencies = [
|
11
11
|
"pydantic>=2.7.2,<3.0.0",
|
@@ -1,42 +0,0 @@
|
|
1
|
-
You can use the Audit API to get fine-grained information about the changes made to any model, usage, user sign-ins,
|
2
|
-
most frequently visited pages and much more. The Audit API exposes most the logs collected by Anaplan.
|
3
|
-
|
4
|
-
For details refer to
|
5
|
-
[the Documentation](https://auditservice.docs.apiary.io/#).
|
6
|
-
|
7
|
-
## Usage
|
8
|
-
|
9
|
-
The method for the Audit API reside in a different namespace for better API navigability and
|
10
|
-
comprehensiveness, but are accessible through the same client for convenience. For e.g., you can call
|
11
|
-
the `.get_events()` method like so:
|
12
|
-
|
13
|
-
/// tab | Synchronous
|
14
|
-
|
15
|
-
```python
|
16
|
-
import anaplan_sdk
|
17
|
-
|
18
|
-
anaplan = anaplan_sdk.Client(
|
19
|
-
workspace_id="AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
|
20
|
-
model_id="11111111111111111111111111111111",
|
21
|
-
certificate="~/certs/anaplan.pem",
|
22
|
-
private_key="~/keys/anaplan.pem",
|
23
|
-
)
|
24
|
-
events = anaplan.audit.get_events()
|
25
|
-
```
|
26
|
-
|
27
|
-
///
|
28
|
-
/// tab | Asynchronous
|
29
|
-
|
30
|
-
```python
|
31
|
-
import anaplan_sdk
|
32
|
-
|
33
|
-
anaplan = anaplan_sdk.AsyncClient(
|
34
|
-
workspace_id="AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
|
35
|
-
model_id="11111111111111111111111111111111",
|
36
|
-
certificate="~/certs/anaplan.pem",
|
37
|
-
private_key="~/keys/anaplan.pem",
|
38
|
-
)
|
39
|
-
events = await anaplan.audit.get_events()
|
40
|
-
```
|
41
|
-
|
42
|
-
///
|
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
|
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
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|