added error handling to send_qso()

This commit is contained in:
Michael Clemens 2021-07-12 14:47:49 +02:00
parent 9c14bace8a
commit 0860dbde8b

View File

@ -351,11 +351,14 @@ class QRZLogger():
else: else:
try: try:
logid = re.search('LOGID=(\d+)', response).group(1) logid = re.search('LOGID=(\d+)', response).group(1)
print(self.successcol)
print("QSO successfully uploaded to QRZ.com (LOGID "+ logid + ")")
log_status = "SUCCESS: "
print(attr('reset'))
except: # pylint: disable=bare-except except: # pylint: disable=bare-except
logid = "null" logid = "null"
print(self.successcol) print(self.errorcol)
print("QSO successfully uploaded to QRZ.com (LOGID "+ logid + ")") print("\nQSO upload to QRZ.com failed!\n")
log_status = "SUCCESS: "
print(attr('reset')) print(attr('reset'))
with open(self.log_file, "a") as log: with open(self.log_file, "a") as log:
log.write(log_status + adif + "\n") log.write(log_status + adif + "\n")
@ -528,7 +531,7 @@ class QRZLogger():
answer = answer.upper() answer = answer.upper()
if answer == "Y": if answer == "Y":
logid = self.send_qso(self.qso, call) logid = self.send_qso(self.qso, call)
if logid and logid != "null": if logid and logid.lower() != "null":
# pull the uploaded QSO from QRZ # pull the uploaded QSO from QRZ
result = self.get_qsos("LOGIDS:"+ logid) result = self.get_qsos("LOGIDS:"+ logid)
if result and result[0]: if result and result[0]: