Add modules/akvorado.py
This commit is contained in:
parent
01c498d752
commit
c85e303eb6
1 changed files with 17 additions and 0 deletions
17
modules/akvorado.py
Normal file
17
modules/akvorado.py
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
import os
|
||||
import requests
|
||||
from dotenv import load_dotenv
|
||||
|
||||
load_dotenv()
|
||||
|
||||
BASE_URL = os.getenv("AKVORADO_BASE_URL", "http://localhost:8081/api/v0/console/widget/top")
|
||||
|
||||
def get_widget_data(endpoint: str):
|
||||
url = f"{BASE_URL}/{endpoint}?0"
|
||||
try:
|
||||
res = requests.get(url)
|
||||
res.raise_for_status()
|
||||
return res.json()
|
||||
except requests.RequestException as e:
|
||||
print(f"Fout bij ophalen van {endpoint}: {e}")
|
||||
return {"top": []}
|
||||
Loading…
Add table
Add a link
Reference in a new issue