qrz: handle addresses that are only whitespace

Fixes #124
This commit is contained in:
Abigail 2019-12-23 11:47:37 -05:00
parent 781a3fa4dd
commit ae67498e75

View File

@ -71,6 +71,7 @@ class QRZCog(commands.Cog):
embed.set_thumbnail(url=resp_data['image']) embed.set_thumbnail(url=resp_data['image'])
data = qrz_process_info(resp_data) data = qrz_process_info(resp_data)
print(data)
for title, val in data.items(): for title, val in data.items():
if val is not None: if val is not None:
@ -139,6 +140,9 @@ def qrz_process_info(data: dict):
state = '' state = ''
address = data.get('addr1', '') + '\n' + data.get('addr2', '') + \ address = data.get('addr1', '') + '\n' + data.get('addr2', '') + \
state + ' ' + data.get('zip', '') state + ' ' + data.get('zip', '')
address = address.strip()
if address == '':
address = None
if 'eqsl' in data: if 'eqsl' in data:
eqsl = 'Yes' if data['eqsl'] == 1 else 'No' eqsl = 'Yes' if data['eqsl'] == 1 else 'No'
else: else: