From 94b695e907301dcdd7a9d2e7041b5b7cc9bd3e15 Mon Sep 17 00:00:00 2001 From: Michaela Wheeler Date: Thu, 30 Dec 2021 15:04:17 +1100 Subject: [PATCH] Resolve uploader none error for data going into elk --- lambda/sonde_api_to_iot_core/__init__.py | 3 +++ lambda/sonde_api_to_iot_core/__main__.py | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/lambda/sonde_api_to_iot_core/__init__.py b/lambda/sonde_api_to_iot_core/__init__.py index fd98fb3..3c6d792 100644 --- a/lambda/sonde_api_to_iot_core/__init__.py +++ b/lambda/sonde_api_to_iot_core/__init__.py @@ -322,11 +322,14 @@ def upload(event, context): if "uploader_position" in payload: if not payload["uploader_position"]: payload.pop("uploader_position") + elif payload['uploader_position'][0] == None or payload['uploader_position'][1] == None: + payload.pop("uploader_position") else: (payload["uploader_alt"], payload["uploader_position"]) = ( payload["uploader_position"][2], f"{payload['uploader_position'][0]},{payload['uploader_position'][1]}", ) + to_sns.append(payload) # if to_sns: diff --git a/lambda/sonde_api_to_iot_core/__main__.py b/lambda/sonde_api_to_iot_core/__main__.py index 8fcfd0e..c44daf6 100644 --- a/lambda/sonde_api_to_iot_core/__main__.py +++ b/lambda/sonde_api_to_iot_core/__main__.py @@ -36,7 +36,7 @@ payload = { "time": "31/Jan/2021:00:10:25 +0000", "timeEpoch": 1612051825409, }, - "body": "H4sIAFsEMmEAA+XaS2/jNhAA4Pv+CiNnh+X74fOiLYr2UvTUojC0MbMRYEuuLDtdFP3vHWlFKiapmMAaEFAtkMOOKVkjfiGHZP74sFr9Az+r1cOpfm5fi8Zuq+JgHzarh6bYlfWprnZ2W5zbetv8/bAOml5scyrrqmtNkEACGnz42uR83NfFzjbbp2K/P5Wf+zYffyY//fjrI+nbXTcrqtZWVdHf6Tu+ei0udnWoq/pY76372rY82G1jn2x5sbuuJcWUPGLziNlvWG4E3giOhDBaqt/dNbuitd116eYM4f6fb34oqvNz8dSeG9t0l/zQFK/+678c+9t8/P4X/yL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