From b517e87bc6a0f9f62e9602d51fc048123f72bc30 Mon Sep 17 00:00:00 2001 From: Michael Clemens Date: Mon, 9 Aug 2021 16:55:52 +0200 Subject: [PATCH] user can now retry if upload failed --- src/qrzlogger/__main__.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/qrzlogger/__main__.py b/src/qrzlogger/__main__.py index 3374b23..b0cc5b9 100755 --- a/src/qrzlogger/__main__.py +++ b/src/qrzlogger/__main__.py @@ -336,6 +336,7 @@ class QRZLogger(): data = urllib.parse.urlencode(post_data) # send the POST request to QRZ.com response = self.send_request(data) + # Check if the upload failed and print out # the reason plus some additional info if response: @@ -530,7 +531,17 @@ class QRZLogger(): self.defvalcol + "y/n/c/quit" + self.inputcol + "]: " + attr('reset')) answer = answer.upper() if answer == "Y": - logid = self.send_qso(self.qso, call) + while True: + logid = self.send_qso(self.qso, call) + if logid and logid != "null": + break + else: + answer = input("\n" + self.inputcol + "QSO Upload failed. Retry? [" + \ + self.defvalcol + "y/n" + self.inputcol + "]: " + attr('reset')) + answer = answer.upper() + if answer == "N": + done = True + break if logid and logid.lower() != "null": # pull the uploaded QSO from QRZ result = self.get_qsos("LOGIDS:"+ logid) @@ -542,6 +553,8 @@ class QRZLogger(): self.recent_qsos.pop(0) done = True break + else: + break elif answer == "C": done = True break