From 2b599e363df2ed52c7e49c296ec4f2c084380af6 Mon Sep 17 00:00:00 2001 From: xss Date: Sun, 22 Jan 2023 20:03:56 +1100 Subject: [PATCH] Add upload call block list --- lambda/sonde_api_to_iot_core/__init__.py | 6 +++++- lambda/sonde_api_to_iot_core/__main__.py | 25 +++++++++++++++++++++++- 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/lambda/sonde_api_to_iot_core/__init__.py b/lambda/sonde_api_to_iot_core/__init__.py index b46c2f7..74c91a5 100644 --- a/lambda/sonde_api_to_iot_core/__init__.py +++ b/lambda/sonde_api_to_iot_core/__init__.py @@ -294,7 +294,11 @@ def telemetry_filter(telemetry): if telemetry["software_name"] == "SondeMonitor": if parse_sondemonitor_version(telemetry["software_version"]) < (6,2,8,4): return (False,f"SondeMonitor version is out of date and doesn't handle DFM radiosondes correctly. Please update to 6.2.8.4 or later") - + + # block callsigns + if telemetry["uploader_callsign"] in ["M00ON-5", "LEKUKU", "BS144"]: + return (False, "Something is wrong with the data your station is uploading, please contact us so we can resolve what is going on. support@sondehub.org") + if "dev" in telemetry: return (False, "All checks passed however payload contained dev flag so will not be uploaded to the database") diff --git a/lambda/sonde_api_to_iot_core/__main__.py b/lambda/sonde_api_to_iot_core/__main__.py index 560d6a8..4e475f7 100644 --- a/lambda/sonde_api_to_iot_core/__main__.py +++ b/lambda/sonde_api_to_iot_core/__main__.py @@ -3,7 +3,30 @@ import json import base64 import gzip import uuid -body = {"software_name": "SondeHubUploader", "software_version": "1.0.0", "uploader_callsign": "SIMON2-14", "uploader_position": [53.23764, 7.74426, 7.0], "uploader_antenna": "5/8-Wave-J-Pole", "time_received": "2023-01-20T22:48:43.208780Z", "datetime": "2023-01-20T22:48:41.000000Z", "manufacturer": "Vaisala", "type": "RS41", "serial": "U1440085", "frame": 1759, "lat": 53.706667, "lon": 7.146944, "alt": 1295.7, "vel_v": 5.5, "vel_h": 6.2, "heading": 222.0, "sats": 10, "batt": 2.9, "frequency": 404.1, "rssi": 70.9} +body = [{ + "dev":True, + "software_name": "SondeHubUploader", + "software_version": "1.0.0", + "uploader_callsign": "a", + "uploader_position": [53.23764, 7.74426, 7.0], + "uploader_antenna": "5/8-Wave-J-Pole", + "time_received": "2023-01-22T22:48:43.208780Z", + "datetime": "2023-01-22T22:48:41.000000Z", + "manufacturer": "Vaisala", + "type": "RS41", + "serial": "U1440085", + "frame": 1759, + "lat": 53.706667, + "lon": 7.146944, + "alt": 1295.7, + "vel_v": 5.5, + "vel_h": 6.2, + "heading": 222.0, + "sats": 10, + "batt": 2.9, + "frequency": 404.1, + "rssi": 70.9 +}] compressed = BytesIO() with gzip.GzipFile(fileobj=compressed, mode='w') as f: