From e1f6e1866a79affed358de49b9eb990f4da09781 Mon Sep 17 00:00:00 2001 From: Cam Date: Wed, 18 Oct 2023 10:11:58 -0500 Subject: [PATCH] added account overview --- sdk/python/sdk/zrok/zrok/__init__.py | 2 +- sdk/python/sdk/zrok/zrok/overview.py | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 sdk/python/sdk/zrok/zrok/overview.py diff --git a/sdk/python/sdk/zrok/zrok/__init__.py b/sdk/python/sdk/zrok/zrok/__init__.py index 3e03028e..c0c01b1e 100644 --- a/sdk/python/sdk/zrok/zrok/__init__.py +++ b/sdk/python/sdk/zrok/zrok/__init__.py @@ -1,4 +1,4 @@ from . import environment -from . import access, decor, model, share +from . import access, decor, model, share, overview monkeypatch = decor.MonkeyPatch \ No newline at end of file diff --git a/sdk/python/sdk/zrok/zrok/overview.py b/sdk/python/sdk/zrok/zrok/overview.py new file mode 100644 index 00000000..1df57639 --- /dev/null +++ b/sdk/python/sdk/zrok/zrok/overview.py @@ -0,0 +1,18 @@ +from zrok.environment.root import Root +import urllib3 +def Overview(root: Root) -> str: + if not root.IsEnabled(): + raise Exception("environment is not enabled; enable with 'zrok enable' first!") + + http = urllib3.PoolManager() + apiEndpoint = root.ApiEndpoint().endpoint + try: + response = http.request( + 'GET', + apiEndpoint + "/api/v1/overview", + headers={ + "X-TOKEN": root.env.Token + }) + except Exception as e: + raise Exception("unable to get account overview", e) + return response.data.decode('utf-8') \ No newline at end of file