Refactor of caching & data storage part 13 #118

This commit is contained in:
Ian Renton
2026-08-03 08:56:34 +01:00
parent e31b145b8e
commit 50ab27e4a2
9 changed files with 200 additions and 638 deletions
+5 -3
View File
@@ -40,7 +40,7 @@ class QRZ(APIQueryCallsignDataProvider):
session_key = lookup_credentials.qrz_session_key
elif lookup_credentials.qrz_username and lookup_credentials.qrz_password:
try:
login_response = self._URL_DATA_CACHE.get(
login_response = self._CREDENTIALS_CACHE.get(
self._QRZ_BASE_URL + "?username=" + urllib.parse.quote_plus(lookup_credentials.qrz_username) +
"&password=" + urllib.parse.quote_plus(lookup_credentials.qrz_password) + "&agent=spothole",
headers=HTTP_HEADERS).content
@@ -49,7 +49,8 @@ class QRZ(APIQueryCallsignDataProvider):
if "Key" in session:
session_key = str(session["Key"])
else:
logging.warning("QRZ.com login details incorrect, failed to look up with QRZ.")
# Log this failure at debug level only, not our problem if user entered the wrong password.
logging.debug("QRZ.com login details incorrect, failed to look up with QRZ.")
return None
except Exception:
logging.error("Exception when getting QRZ.com session key")
@@ -146,9 +147,10 @@ class QRZ(APIQueryCallsignDataProvider):
name=name,
qth=data["addr2"] if "addr2" in data else None,
country=data["country"] if "country" in data else None,
continent=data["continent"] if "continent" in data else None,
latitude=lat,
longitude=lon,
grid=grid,
dxcc_id=int(data["adif"]) if "adif" in data else None,
cq_zone=int(data["cqzone"]) if "cqzone" in data else None,
itu_zone=int(data["ituzone"]) if "adif" in data else None)
itu_zone=int(data["ituzone"]) if "ituzone" in data else None)