added logging of failed and successfull QSOs as ADIf into log file
This commit is contained in:
parent
0c7e099cb8
commit
c225aeebfc
|
@ -5,6 +5,7 @@ api_key = 1234-ABCD-1234-A1B2
|
||||||
qrz_user = N0CALL
|
qrz_user = N0CALL
|
||||||
qrz_pass = q1w2e3r4t5z6u7i8o9
|
qrz_pass = q1w2e3r4t5z6u7i8o9
|
||||||
xml_fields = ("call", "band", "mode", "qso_date", "time_on", "rst_sent", "rst_rcvd", "comment")
|
xml_fields = ("call", "band", "mode", "qso_date", "time_on", "rst_sent", "rst_rcvd", "comment")
|
||||||
|
log_file = qrzlogger.log
|
||||||
|
|
||||||
# default values for new QSOs
|
# default values for new QSOs
|
||||||
band = 40m
|
band = 40m
|
||||||
|
|
10
qrzlogger.py
10
qrzlogger.py
|
@ -65,6 +65,11 @@ headers["Content-Type"] = "application/x-www-form-urlencoded"
|
||||||
session = None
|
session = None
|
||||||
session_key = None
|
session_key = None
|
||||||
|
|
||||||
|
if config['qrzlogger']['log_file']:
|
||||||
|
log_file = config['qrzlogger']['log_file']
|
||||||
|
else:
|
||||||
|
log_file = "qrzlogger.log"
|
||||||
|
|
||||||
# Read user definable colors from config
|
# Read user definable colors from config
|
||||||
if config['qrzlogger']['use_colors'] == "yes":
|
if config['qrzlogger']['use_colors'] == "yes":
|
||||||
inputcol = eval(config['qrzlogger']['inputcol'])
|
inputcol = eval(config['qrzlogger']['inputcol'])
|
||||||
|
@ -328,6 +333,7 @@ def queryQSOData(qso):
|
||||||
# QRZ.com logbook entry via the API
|
# QRZ.com logbook entry via the API
|
||||||
def sendQSO(qso):
|
def sendQSO(qso):
|
||||||
logid = "null"
|
logid = "null"
|
||||||
|
log_status = "FAILED: "
|
||||||
|
|
||||||
# construct ADIF QSO entry
|
# construct ADIF QSO entry
|
||||||
adif = '<station_callsign:' + str(len(config['qrzlogger']['station_call'])) + '>' + config['qrzlogger']['station_call']
|
adif = '<station_callsign:' + str(len(config['qrzlogger']['station_call'])) + '>' + config['qrzlogger']['station_call']
|
||||||
|
@ -362,12 +368,16 @@ def sendQSO(qso):
|
||||||
logid = "null"
|
logid = "null"
|
||||||
print(successcol)
|
print(successcol)
|
||||||
print("QSO successfully uploaded to QRZ.com (LOGID "+ logid + ")")
|
print("QSO successfully uploaded to QRZ.com (LOGID "+ logid + ")")
|
||||||
|
log_status = "SUCCESS: "
|
||||||
print(style.RESET)
|
print(style.RESET)
|
||||||
|
with open(log_file, "a") as log:
|
||||||
|
log.write(log_status + adif + "\n")
|
||||||
return logid
|
return logid
|
||||||
else:
|
else:
|
||||||
print(errorcol + "\nA critical error occured. Please review all previous output." + style.RESET)
|
print(errorcol + "\nA critical error occured. Please review all previous output." + style.RESET)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# ask a user a simple y/n question
|
# ask a user a simple y/n question
|
||||||
# returns True if "y"
|
# returns True if "y"
|
||||||
# returns False in "n"
|
# returns False in "n"
|
||||||
|
|
Loading…
Reference in New Issue