Most providers don't need the ability to override names

This commit is contained in:
Ian Renton
2026-07-30 18:56:53 +01:00
parent fffd230633
commit 266468f938
46 changed files with 72 additions and 93 deletions
+2 -2
View File
@@ -8,10 +8,10 @@ from core.config import MAX_ALERT_AGE
class AlertProvider:
"""Generic alert provider class. Subclasses of this query the individual APIs for alerts."""
def __init__(self, provider_config):
def __init__(self, name, provider_config):
"""Constructor"""
self.name = provider_config["name"]
self.name = name
self.enabled = provider_config["enabled"]
self.last_update_time = datetime.min.replace(tzinfo=pytz.UTC)
self.status = "Not Started" if self.enabled else "Disabled"
+1 -1
View File
@@ -15,7 +15,7 @@ class BOTA(HTTPAlertProvider):
ALERTS_URL = "https://www.beachesontheair.com/"
def __init__(self, provider_config):
super().__init__(provider_config, self.ALERTS_URL, self.POLL_INTERVAL_SEC)
super().__init__("BOTA", provider_config, self.ALERTS_URL, self.POLL_INTERVAL_SEC)
def _http_response_to_alerts(self, http_response):
new_alerts = []
+2 -2
View File
@@ -14,8 +14,8 @@ class HTTPAlertProvider(AlertProvider):
"""Generic alert provider class for providers that request data via HTTP(S). Just for convenience to avoid code
duplication. Subclasses of this query the individual APIs for data."""
def __init__(self, provider_config, url, poll_interval):
super().__init__(provider_config)
def __init__(self, name, provider_config, url, poll_interval):
super().__init__(name, provider_config)
self._url = url
self._poll_interval = poll_interval
self._thread = None
+1 -1
View File
@@ -18,7 +18,7 @@ class NG3K(HTTPAlertProvider):
AS_CALL_PATTERN = re.compile("as ([a-z0-9/]+)", re.IGNORECASE)
def __init__(self, provider_config):
super().__init__(provider_config, self.ALERTS_URL, self.POLL_INTERVAL_SEC)
super().__init__("NG3K", provider_config, self.ALERTS_URL, self.POLL_INTERVAL_SEC)
def _http_response_to_alerts(self, http_response):
new_alerts = []
+1 -1
View File
@@ -15,7 +15,7 @@ class ParksNPeaks(HTTPAlertProvider):
ALERTS_URL = "https://parksnpeaks.org/api/ALERTS/"
def __init__(self, provider_config):
super().__init__(provider_config, self.ALERTS_URL, self.POLL_INTERVAL_SEC)
super().__init__("ParksNPeaks", provider_config, self.ALERTS_URL, self.POLL_INTERVAL_SEC)
def _http_response_to_alerts(self, http_response):
new_alerts = []
+1 -1
View File
@@ -14,7 +14,7 @@ class POTA(HTTPAlertProvider):
ALERTS_URL = "https://api.pota.app/activation"
def __init__(self, provider_config):
super().__init__(provider_config, self.ALERTS_URL, self.POLL_INTERVAL_SEC)
super().__init__("POTA", provider_config, self.ALERTS_URL, self.POLL_INTERVAL_SEC)
def _http_response_to_alerts(self, http_response):
new_alerts = []
+1 -1
View File
@@ -14,7 +14,7 @@ class SOTA(HTTPAlertProvider):
ALERTS_URL = "https://api-db2.sota.org.uk/api/alerts/365/all/all"
def __init__(self, provider_config):
super().__init__(provider_config, self.ALERTS_URL, self.POLL_INTERVAL_SEC)
super().__init__("SOTA", provider_config, self.ALERTS_URL, self.POLL_INTERVAL_SEC)
def _http_response_to_alerts(self, http_response):
new_alerts = []
+1 -1
View File
@@ -18,7 +18,7 @@ class WOTA(HTTPAlertProvider):
RSS_DATE_TIME_FORMAT = "%a, %d %b %Y %H:%M:%S %z"
def __init__(self, provider_config):
super().__init__(provider_config, self.ALERTS_URL, self.POLL_INTERVAL_SEC)
super().__init__("WOTA", provider_config, self.ALERTS_URL, self.POLL_INTERVAL_SEC)
def _http_response_to_alerts(self, http_response):
new_alerts = []
+1 -1
View File
@@ -14,7 +14,7 @@ class WWFF(HTTPAlertProvider):
ALERTS_URL = "https://spots.wwff.co/static/agendas.json"
def __init__(self, provider_config):
super().__init__(provider_config, self.ALERTS_URL, self.POLL_INTERVAL_SEC)
super().__init__("WWFF", provider_config, self.ALERTS_URL, self.POLL_INTERVAL_SEC)
def _http_response_to_alerts(self, http_response):
new_alerts = []