mirror of
https://git.ianrenton.com/ian/spothole.git
synced 2026-09-20 14:27:42 +00:00
More defensive coding
This commit is contained in:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user