diff --git a/.gitignore b/.gitignore index 0d23ef8..b618d10 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,6 @@ !/root !/.gitignore !/uptime-kuma-homepage.py -!/example.env +!/example.env.py /root/homepagehtml.html diff --git a/example.env b/example.env.py similarity index 100% rename from example.env rename to example.env.py diff --git a/uptime-kuma-homepage.py b/uptime-kuma-homepage.py index 3431429..7a32886 100755 --- a/uptime-kuma-homepage.py +++ b/uptime-kuma-homepage.py @@ -1,5 +1,5 @@ #! /bin/python3 -import json,os +import json,env from uptime_kuma_api import UptimeKumaApi, MonitorType descriptions = { @@ -16,10 +16,10 @@ descriptions = { exclude=('Synapse','Mailserver') HTMLTEMPLATE='

{item}

{desc}

' htmllist=[] -htmllist.append(HTMLTEMPLATE.format(link=os.environ.get('UPTIME_KUMA_URL'),item="Uptime Kuma",desc=descriptions["Uptime Kuma"])) +htmllist.append(HTMLTEMPLATE.format(link=UPTIME_KUMA_URL,item="Uptime Kuma",desc=descriptions["Uptime Kuma"])) -with UptimeKumaApi(os.environ.get('UPTIME_KUMA_URL')) as api: - api.login(os.environ.get('UPTIME_KUMA_ADMIN_USER'),os.environ.get('UPTIME_KUMA_ADMIN_PASSWORD')) +with UptimeKumaApi(UPTIME_KUMA_URL) as api: + api.login(UPTIME_KUMA_ADMIN_USER,UPTIME_KUMA_ADMIN_PASSWORD) for item in api.get_monitors(): if item["name"] in exclude or item["type"] == MonitorType.GROUP: continue @@ -31,5 +31,5 @@ with UptimeKumaApi(os.environ.get('UPTIME_KUMA_URL')) as api: htmllist.append(HTMLTEMPLATE.format(link=item["url"],item=item["name"],desc="")) -with open(os.environ.get('UPTIME_KUMA_OUT'),"w") as htmlfile: +with open(UPTIME_KUMA_OUT,"w") as htmlfile: htmlfile.write("\n".join(htmllist))