mirror of
https://git.ianrenton.com/ian/spothole.git
synced 2026-08-05 18:11:41 +00:00
Improve error reporting consistency and ensure SEMI_STATIC_URL_DATA_CACHE caches 400-series responses from the server so we don't keep requesting summit/park/bunker data for a reference that the user typod and doesn't actually exist.
This commit is contained in:
@@ -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)
|
||||
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user