mirror of
https://github.com/openziti/zrok.git
synced 2025-01-11 00:18:43 +01:00
added account overview
This commit is contained in:
parent
1dbab328c5
commit
e1f6e1866a
@ -1,4 +1,4 @@
|
|||||||
from . import environment
|
from . import environment
|
||||||
from . import access, decor, model, share
|
from . import access, decor, model, share, overview
|
||||||
|
|
||||||
monkeypatch = decor.MonkeyPatch
|
monkeypatch = decor.MonkeyPatch
|
18
sdk/python/sdk/zrok/zrok/overview.py
Normal file
18
sdk/python/sdk/zrok/zrok/overview.py
Normal file
@ -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')
|
Loading…
Reference in New Issue
Block a user