mirror of
https://github.com/SpudGunMan/meshing-around.git
synced 2026-08-07 09:22:44 +02:00
NINA alerts
@sodoku 👀 branch for testing new alerts
This commit is contained in:
+3
-11
@@ -32,25 +32,17 @@ def get_nina_alerts():
|
||||
try:
|
||||
# get api.bund.dev alerts
|
||||
alerts = []
|
||||
|
||||
for regionalKey in myRegionalKeys:
|
||||
|
||||
url = (
|
||||
"https://nina.api.proxy.bund.dev/api31/dashboard/" + regionalKey + ".json"
|
||||
)
|
||||
for regionalKey in myRegionalKeysDE:
|
||||
url = ("https://nina.api.proxy.bund.dev/api31/dashboard/" + regionalKey + ".json")
|
||||
response = requests.get(url)
|
||||
data = response.json()
|
||||
|
||||
|
||||
for item in data:
|
||||
title = item["i18nTitle"]["de"]
|
||||
alerts.append(f"🚨 {title}")
|
||||
|
||||
|
||||
return "\n".join(alerts) if alerts else NO_ALERTS
|
||||
|
||||
except Exception as e:
|
||||
logger.warning("Error getting NINA alerts: " + str(e))
|
||||
logger.warning("Error getting NINA DE alerts: " + str(e))
|
||||
return NO_ALERTS
|
||||
|
||||
def get_wxUKgov():
|
||||
|
||||
Reference in New Issue
Block a user