diff --git a/config.template b/config.template index 7449e82..cf36266 100644 --- a/config.template +++ b/config.template @@ -124,8 +124,10 @@ repeaterLookup = rbook NOAAforecastDuration = 4 # number of weather alerts to display NOAAalertCount = 2 + # use Open-Meteo API for weather data not NOAA useful for non US locations UseMeteoWxAPI = False +includeEUalerts = False # NOAA Hydrology # unique identifiers, LID or USGS ID diff --git a/modules/locationdata_eu.py b/modules/locationdata_eu.py index e4d36d0..7a204bc 100644 --- a/modules/locationdata_eu.py +++ b/modules/locationdata_eu.py @@ -9,13 +9,21 @@ import bs4 as bs # pip install beautifulsoup4 import xml.dom.minidom from modules.log import * +trap_list_location_eu = ("ukalert", "ukwx", "ukflood") + def get_govUK_alerts(): # get UK weather alerts url = 'https://www.gov.uk/alerts' response = requests.get(url) soup = bs.BeautifulSoup(response.text, 'html.parser') - return "not implemented yet" + # the alerts are in

+ alert = soup.find('h2', class_='govuk-heading-m', id='alert-status') + if alert: + return alert.text + else: + return "No alerts" + def get_wxUKgov(): # get UK weather warnings url = 'https://www.metoffice.gov.uk/weather/guides/rss' diff --git a/modules/settings.py b/modules/settings.py index db6446f..4765ce5 100644 --- a/modules/settings.py +++ b/modules/settings.py @@ -155,6 +155,7 @@ try: latitudeValue = config['location'].getfloat('lat', 48.50) longitudeValue = config['location'].getfloat('lon', -123.0) use_meteo_wxApi = config['location'].getboolean('UseMeteoWxAPI', False) # default False use NOAA + includeEUalerts = config['location'].getboolean('includeEUalerts', False) # default False use_metric = config['location'].getboolean('useMetric', False) # default Imperial units forecastDuration = config['location'].getint('NOAAforecastDuration', 4) # NOAA forcast days numWxAlerts = config['location'].getint('NOAAalertCount', 2) # default 2 alerts diff --git a/modules/system.py b/modules/system.py index 0871e49..0559f82 100644 --- a/modules/system.py +++ b/modules/system.py @@ -74,6 +74,10 @@ if location_enabled: from modules.locationdata import * # from the spudgunman/meshing-around repo trap_list = trap_list + trap_list_location # items tide, whereami, wxc, wx help_message = help_message + ", whereami, wx, wxc, rlist" + if includeEUalerts: + from modules.locationdata_eu import * # from the spudgunman/meshing-around repo + trap_list = trap_list + trap_list_location_eu + #help_message = help_message + ", ukalert, ukwx, ukflood" # Open-Meteo Configuration for worldwide weather if use_meteo_wxApi: