mirror of
https://git.ianrenton.com/ian/spothole.git
synced 2026-08-06 02:21:42 +00:00
Improve error handling to spare the server log from user's malformed requests and stop trying to parse data from providers if the HTTP status was not 200
This commit is contained in:
@@ -127,10 +127,11 @@ class GIROIonosonde(SolarConditionsProvider):
|
||||
from_str = from_time.strftime("%Y.%m.%d+%H:%M:%S")
|
||||
to_str = to_time.strftime("%Y.%m.%d+%H:%M:%S")
|
||||
url = f"{LGDC_URL}?ursiCode={ursi}&charName=foF2,MUFD,fmin&DMUF=3000&fromDate={from_str}&toDate={to_str}"
|
||||
response = requests.get(url, headers=HTTP_HEADERS, timeout=(5, 15))
|
||||
if response.status_code != 200:
|
||||
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}.")
|
||||
return None, None, None
|
||||
return self._parse_all(response.text)
|
||||
return self._parse_all(http_response.text)
|
||||
|
||||
@staticmethod
|
||||
def _parse_all(text):
|
||||
|
||||
Reference in New Issue
Block a user