diff --git a/core/lookup_helper.py b/core/lookup_helper.py index f4f7363..ed9aa22 100644 --- a/core/lookup_helper.py +++ b/core/lookup_helper.py @@ -511,13 +511,20 @@ class LookupHelper: self._qrz_base_url + "?s=" + session_key + "&callsign=" + urllib.parse.quote_plus(lookup_call), headers=HTTP_HEADERS, timeout=10) if response.ok: - raw = xmltodict.parse(response.content).get("QRZDatabase", {}).get("Callsign") - if raw: - data = _normalize_qrz_data(raw) - self._qrz_callsign_data_cache.add(call, data, expire=604800) # 1 week in seconds - return data + qrz_response = xmltodict.parse(response.content).get("QRZDatabase", {}) + if qrz_response: + if "Callsign" in qrz_response: + data = _normalize_qrz_data(qrz_response.get("Callsign")) + self._qrz_callsign_data_cache.add(call, data, expire=604800) # 1 week in seconds + return data + elif "Session" in qrz_response and "Error" in qrz_response.get("Session"): + # Errors here are normally just "callsign not in database", no need to log that ourselves + # above debug level. + logging.debug("QRZ returned an error looking up callsign %s: %s", lookup_call, + qrz_response.get("Session").get("Error")) + elif not response.from_cache: - logging.warning("Malformed response looking up callsign %s using QRZ", lookup_call) + logging.warning("QRZ returned a malformed response looking up callsign %s", lookup_call) elif not response.from_cache: logging.warning("HTTP %d looking up callsign %s using QRZ", lookup_call) @@ -525,9 +532,10 @@ class LookupHelper: continue except ConnectionError: logging.warning(f"Connection error when looking up callsign %s using QRZ", lookup_call) + continue except Exception: - logging.error("Exception when looking up callsign %s using QRZ", lookup_call) - return None + logging.error("Exception when looking up callsign %s using QRZ", lookup_call, exc_info=True) + continue # Not found in QRZ; cache None so we don't keep retrying self._qrz_callsign_data_cache.add(call, None, expire=604800) # 1 week in seconds @@ -580,15 +588,15 @@ class LookupHelper: return data elif not response.from_cache: logging.warning("HTTP %d looking up callsign %s using HamQTH", response.status_code, lookup_call) - return None except (KeyError, ValueError): continue except ConnectionError: logging.warning(f"Connection error when looking up callsign %s using HamQTH", lookup_call) + continue except Exception: - logging.error("Exception when looking up callsign %s using HamQTH", lookup_call) - return None + logging.error("Exception when looking up callsign %s using HamQTH", lookup_call, exc_info=True) + continue # Not found in HamQTH; cache None so we don't keep retrying self._hamqth_callsign_data_cache.add(call, None, expire=604800) # 1 week in seconds diff --git a/spotproviders/gma.py b/spotproviders/gma.py index 9bb53ee..3942238 100644 --- a/spotproviders/gma.py +++ b/spotproviders/gma.py @@ -98,13 +98,13 @@ class GMA(HTTPSpotProvider): # other code will do that for us. new_spots.append(spot) - elif not ref_response.from_cache: - if not ref_response.ok: - logging.warning( - f"HTTP {ref_response.status_code} when looking up GMA ref {source_spot["REF"]}") - else: - logging.warning( - f"GMA API returned a malformed response when looking up ref {source_spot["REF"]}") + elif not ref_response.from_cache: + if not ref_response.ok: + logging.warning( + f"HTTP {ref_response.status_code} when looking up GMA ref {source_spot["REF"]}") + else: + logging.warning( + f"GMA API returned a malformed response when looking up ref {source_spot["REF"]}") except: logging.warning("Exception when looking up " + self.REF_INFO_URL_ROOT + source_spot[ "REF"] + ", ignoring this spot for now") diff --git a/templates/add_spot.html b/templates/add_spot.html index 75c4ec4..2abe093 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 6b03924..249dc23 100644 --- a/templates/alerts.html +++ b/templates/alerts.html @@ -75,7 +75,7 @@ - + diff --git a/templates/bands.html b/templates/bands.html index af63fe2..544782a 100644 --- a/templates/bands.html +++ b/templates/bands.html @@ -75,8 +75,8 @@ - - + + diff --git a/templates/base.html b/templates/base.html index 682fc6e..d1e8097 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 1cdc718..dd07614 100644 --- a/templates/conditions.html +++ b/templates/conditions.html @@ -284,7 +284,7 @@
- + diff --git a/templates/map.html b/templates/map.html index b2b8889..d9b9dc0 100644 --- a/templates/map.html +++ b/templates/map.html @@ -95,8 +95,8 @@ - - + + diff --git a/templates/spots.html b/templates/spots.html index b5c8d37..96501e3 100644 --- a/templates/spots.html +++ b/templates/spots.html @@ -116,8 +116,8 @@ - - + + diff --git a/templates/status.html b/templates/status.html index ef05c15..2d14a8b 100644 --- a/templates/status.html +++ b/templates/status.html @@ -59,7 +59,7 @@ - +