diff --git a/alertproviders/http_alert_provider.py b/alertproviders/http_alert_provider.py index a59a003..1abb4ee 100644 --- a/alertproviders/http_alert_provider.py +++ b/alertproviders/http_alert_provider.py @@ -54,7 +54,7 @@ class HTTPAlertProvider(AlertProvider): logging.debug("Received data from " + self.name + " alert API.") else: self.status = "Error" - logging.warning(f"{self.name} alert API returned HTTP {http_response.status_code}.") + logging.warning(f"HTTP {http_response.status_code} when calling {self.name} alerts API.") except Exception: self.status = "Error" diff --git a/core/cache_utils.py b/core/cache_utils.py index 2ec492c..68e521f 100644 --- a/core/cache_utils.py +++ b/core/cache_utils.py @@ -8,8 +8,11 @@ from requests_cache import CachedSession # of time has passed. This is used throughout Spothole to cache data that does not change # rapidly. The ThreadSafeSession construct here protects it against some multithreading # contention weirdness we sometimes used to see on startup where the cache was hammered -# pretty hard. -_session = CachedSession("cache/semi_static_url_data_cache", expire_after=timedelta(days=30)) +# pretty hard. The expanded list of allowable_codes ensures we also cache and return 400-type +# responses, e.g "this SOTA summit ref doesn't actually exist", to avoid hammering remote +# servers for data they've told us they can't provide. +_session = CachedSession("cache/semi_static_url_data_cache", expire_after=timedelta(days=30), + allowable_codes=(200, 400, 401, 403, 404)) _lock = threading.Lock() diff --git a/solarconditionsproviders/giroionosonde.py b/solarconditionsproviders/giroionosonde.py index 86d2042..c85960d 100644 --- a/solarconditionsproviders/giroionosonde.py +++ b/solarconditionsproviders/giroionosonde.py @@ -129,7 +129,7 @@ class GIROIonosonde(SolarConditionsProvider): url = f"{LGDC_URL}?ursiCode={ursi}&charName=foF2,MUFD,fmin&DMUF=3000&fromDate={from_str}&toDate={to_str}" http_response = requests.get(url, headers=HTTP_HEADERS, timeout=(5, 15)) if http_response.status_code != 200: - logging.warning(f"Giro ionosonde API returned HTTP {http_response.status_code}.") + logging.warning(f"HTTP {http_response.status_code} when calling Giro ionosonde API.") return None, None, None return self._parse_all(http_response.text) diff --git a/solarconditionsproviders/http_solar_conditions_provider.py b/solarconditionsproviders/http_solar_conditions_provider.py index 4a639fd..b3a0064 100644 --- a/solarconditionsproviders/http_solar_conditions_provider.py +++ b/solarconditionsproviders/http_solar_conditions_provider.py @@ -49,7 +49,7 @@ class HTTPSolarConditionsProvider(SolarConditionsProvider): logging.debug("Received data from " + self.name + " solar conditions API.") else: self.status = "Error" - logging.warning(f"{self.name} solar conditions API returned HTTP {http_response.status_code}.") + logging.warning(f"HTTP {http_response.status_code} when calling {self.name} solar conditions API.") except Exception: self.status = "Error" diff --git a/solarconditionsproviders/kc2gprop.py b/solarconditionsproviders/kc2gprop.py index 99660ad..d1aa1b0 100644 --- a/solarconditionsproviders/kc2gprop.py +++ b/solarconditionsproviders/kc2gprop.py @@ -46,7 +46,7 @@ class KC2GProp(SolarConditionsProvider): logging.debug("Polling KC2G ionosonde data...") http_response = requests.get(KC2G_URL, headers=HTTP_HEADERS, timeout=(5, 30)) if http_response.status_code != 200: - logging.warning(f"KC2G ionosonde API returned HTTP {http_response.status_code}") + logging.warning(f"HTTP {http_response.status_code} when calling KG2G ionosonde API.") return now = datetime.now(timezone.utc) diff --git a/spotproviders/http_spot_provider.py b/spotproviders/http_spot_provider.py index 57bd046..37038c7 100644 --- a/spotproviders/http_spot_provider.py +++ b/spotproviders/http_spot_provider.py @@ -54,7 +54,7 @@ class HTTPSpotProvider(SpotProvider): logging.debug("Received data from " + self.name + " spot API.") else: self.status = "Error" - logging.warning(f"{self.name} spot API returned HTTP {http_response.status_code}.") + logging.warning(f"HTTP {http_response.status_code} when calling {self.name} spot API.") except Exception: self.status = "Error" diff --git a/templates/add_spot.html b/templates/add_spot.html index 587c910..56b2739 100644 --- a/templates/add_spot.html +++ b/templates/add_spot.html @@ -76,7 +76,7 @@ - + diff --git a/templates/alerts.html b/templates/alerts.html index 26dff8c..73f0081 100644 --- a/templates/alerts.html +++ b/templates/alerts.html @@ -75,7 +75,7 @@ - + diff --git a/templates/bands.html b/templates/bands.html index 5c0203a..a4d206f 100644 --- a/templates/bands.html +++ b/templates/bands.html @@ -75,8 +75,8 @@ - - + + diff --git a/templates/base.html b/templates/base.html index a801bba..45842c0 100644 --- a/templates/base.html +++ b/templates/base.html @@ -1,6 +1,6 @@ {% extends "skeleton.html" %} {% block head_extra %} - + @@ -10,10 +10,10 @@ - - - - + + + + {% end %} {% block body %}
diff --git a/templates/conditions.html b/templates/conditions.html index 8124c77..15273a7 100644 --- a/templates/conditions.html +++ b/templates/conditions.html @@ -284,7 +284,7 @@
- + diff --git a/templates/map.html b/templates/map.html index ec5c18d..2e64fba 100644 --- a/templates/map.html +++ b/templates/map.html @@ -95,8 +95,8 @@ - - + + diff --git a/templates/spots.html b/templates/spots.html index 701fce4..22fc625 100644 --- a/templates/spots.html +++ b/templates/spots.html @@ -116,8 +116,8 @@ - - + + diff --git a/templates/status.html b/templates/status.html index 0454209..3da2d06 100644 --- a/templates/status.html +++ b/templates/status.html @@ -59,7 +59,7 @@ - +