From cb3c5eb94e0d6667613733ebe91be9e0d19a65e1 Mon Sep 17 00:00:00 2001 From: DJ2LS <75909252+DJ2LS@users.noreply.github.com> Date: Fri, 3 Feb 2023 13:30:42 +0100 Subject: [PATCH] fixed parameter encoding in stats --- tnc/rigctld.py | 5 +---- tnc/stats.py | 14 ++++++++------ 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/tnc/rigctld.py b/tnc/rigctld.py index 99b6d50c..b979139a 100644 --- a/tnc/rigctld.py +++ b/tnc/rigctld.py @@ -242,10 +242,7 @@ class radio: if 'RPRT' not in alc: try: alc = float(alc) - if alc != 0.0: - self.alc = alc - else: - self.alc = static.HAMLIB_ALC + self.alc = alc if alc != 0.0 else static.HAMLIB_ALC except ValueError: self.alc = 0.0 diff --git a/tnc/stats.py b/tnc/stats.py index 60132833..e01de8fc 100644 --- a/tnc/stats.py +++ b/tnc/stats.py @@ -20,6 +20,7 @@ log = structlog.get_logger("stats") class stats(): def __init__(self): self.explorer_url = "https://api.freedata.app/stats.php" + def push(self): """ $callsign = $json["callsign"]; @@ -40,24 +41,25 @@ class stats(): headers = {"Content-Type": "application/json"} station_data = { - 'callsign': str(static.MYCALLSIGN, "utf-8"), - 'dxcallsign': str(static.DXCALLSIGN, "utf-8"), + #'callsign': str(static.MYCALLSIGN, "utf-8"), + #'dxcallsign': str(static.DXCALLSIGN, "utf-8"), 'gridsquare': str(static.MYGRID, "utf-8"), 'dxgridsquare': str(static.DXGRID, "utf-8"), 'frequency': 0 if static.HAMLIB_FREQUENCY is None else static.HAMLIB_FREQUENCY, 'avgstrength': 0, 'avgsnr': 0, - 'bytesperminute': str(static.ARQ_BYTES_PER_MINUTE, "utf-8"), - 'filesize': str(static.TOTAL_BYTES, "utf-8"), - 'compressionfactor': str(static.ARQ_COMPRESSION_FACTOR, "utf-8"), + 'bytesperminute': static.ARQ_BYTES_PER_MINUTE, + 'filesize': static.TOTAL_BYTES, + 'compressionfactor': static.ARQ_COMPRESSION_FACTOR, 'nacks': 0, 'crcerror': 0, 'duration': 0, 'percentage': 0, - 'version': str(static.VERSION, "utf-8") + 'version': static.VERSION } station_data = json.dumps(station_data) + print(station_data) try: response = requests.post(self.explorer_url, json=station_data, headers=headers) log.info("[STATS] push", code=response.status_code)