More defensive coding

This commit is contained in:
Ian Renton
2026-08-17 13:43:40 +01:00
parent 7623ae667e
commit 03164d747f
10 changed files with 27 additions and 19 deletions
+7
View File
@@ -129,6 +129,13 @@ class QRZ(APIQueryCallsignDataProvider):
def qrz_response_to_callsign(callsign, data):
"""Convert the "Callsign" block in QRZ's API response to our own Callsign object."""
# I have encountered a user passing multiple callsigns to the QRZ lookup function in a way that QRZ actually
# does handle, and returns a list of callsign data. If we encounter that, just take the first one, as our own
# functions can't deal with multiple calls this way.
if isinstance(data, list):
data = data[0]
callsign = data["call"]
# Get a name
name = None
if "name_fmt" in data: