bug fixes

This commit is contained in:
Michael Clemens 2021-05-20 22:55:40 +02:00
parent 1d0aab5406
commit 00bfc85f3b
1 changed files with 14 additions and 16 deletions

View File

@ -229,23 +229,21 @@ def queryQSOData(qso):
# QRZ.com logbook entry via the API # QRZ.com logbook entry via the API
def sendQSO(qso): def sendQSO(qso):
insert = { 'KEY' : config['qrzlogger']['api_key'], 'ACTION' : 'INSERT', 'ADIF' : # construct ADIF QSO entry
'<band:' + str(len(qso['band'][1])) + '>' + qso['band'][1] + adif = '<station_callsign:' + str(len(config['qrzlogger']['station_call'])) + '>' + config['qrzlogger']['station_call']
'<mode:' + str(len(qso['mode'][1])) + '>' + qso['mode'][1] + adif += '<call:' + str(len(call)) + '>' + call
'<call:' + str(len(call)) + '>' + call + for field in qso:
'<qso_date:' + str(len(qso['qso_date'][1])) + '>' + qso['qso_date'][1] + adif += '<' + field + ':' + str(len(qso[field][1])) + '>' + qso[field][1]
'<station_callsign:' + str(len(config['qrzlogger']['station_call'])) + '>' + config['qrzlogger']['station_call'] + adif += '<eor>'
'<time_on:' + str(len(qso['time_on'][1])) + '>' + qso['time_on'][1] +
'<rst_rcvd:' + str(len(qso['rst_rcvd'][1])) + '>' + qso['rst_rcvd'][1] +
'<rst_sent:' + str(len(qso['rst_sent'][1])) + '>' + qso['rst_sent'][1] +
'<tx_pwr:' + str(len(qso['tx_pwr'][1])) + '>' + qso['tx_pwr'][1] +
'<comment:' + str(len(qso['comment'][1])) + '>' + qso['comment'][1] +
'<eor>'}
print(insert)
data = urllib.parse.urlencode(insert) # construct POST data
#print(data) post_data = { 'KEY' : config['qrzlogger']['api_key'], 'ACTION' : 'INSERT', 'ADIF' : adif }
#resp = requests.post(config['qrzlogger']['api_url'], data=insert)
print(post_data)
# URL encode the payload
data = urllib.parse.urlencode(post_data)
# send the POST request to QRZ.com
resp = requests.post(config['qrzlogger']['api_url'], headers=headers, data=data) resp = requests.post(config['qrzlogger']['api_url'], headers=headers, data=data)
#str_resp = resp.content.decode("utf-8") #str_resp = resp.content.decode("utf-8")