Resolve uploader none error for data going into elk

This commit is contained in:
Michaela Wheeler 2021-12-30 15:04:17 +11:00
parent f52ae68389
commit 94b695e907
2 changed files with 4 additions and 1 deletions

View File

@ -322,11 +322,14 @@ def upload(event, context):
if "uploader_position" in payload: if "uploader_position" in payload:
if not payload["uploader_position"]: if not payload["uploader_position"]:
payload.pop("uploader_position") payload.pop("uploader_position")
elif payload['uploader_position'][0] == None or payload['uploader_position'][1] == None:
payload.pop("uploader_position")
else: else:
(payload["uploader_alt"], payload["uploader_position"]) = ( (payload["uploader_alt"], payload["uploader_position"]) = (
payload["uploader_position"][2], payload["uploader_position"][2],
f"{payload['uploader_position'][0]},{payload['uploader_position'][1]}", f"{payload['uploader_position'][0]},{payload['uploader_position'][1]}",
) )
to_sns.append(payload) to_sns.append(payload)
# if to_sns: # if to_sns:

View File

@ -36,7 +36,7 @@ payload = {
"time": "31/Jan/2021:00:10:25 +0000", "time": "31/Jan/2021:00:10:25 +0000",
"timeEpoch": 1612051825409, "timeEpoch": 1612051825409,
}, },
"body": "H4sIAFsEMmEAA+XaS2/jNhAA4Pv+CiNnh+X74fOiLYr2UvTUojC0MbMRYEuuLDtdFP3vHWlFKiapmMAaEFAtkMOOKVkjfiGHZP74sFr9Az+r1cOpfm5fi8Zuq+JgHzarh6bYlfWprnZ2W5zbetv8/bAOml5scyrrqmtNkEACGnz42uR83NfFzjbbp2K/P5Wf+zYffyY//fjrI+nbXTcrqtZWVdHf6Tu+ei0udnWoq/pY76372rY82G1jn2x5sbuuJcWUPGLziNlvWG4E3giOhDBaqt/dNbuitd116eYM4f6fb34oqvNz8dSeG9t0l/zQFK/+678c+9t8/P4X/yLOn95EsfFx25TFvk9GY40Zx+6T5+br2yWMMGYIFmz4YF+0EOYKaUYUd8H+3RKMtGGaDMFi37UkUmvEqXs2ezhCUCE5BC52v71AhCLC34ReIAT9pIfQi4U+rj5DUENDd7NT0Z4gZIb/firatr+MuTu9nA/lrmy/QPSR+MTsX2dbPXVBjikS2F1/qpo+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Hn/srziQBqUEvpCN+H4AB2OKyVVrQR62JQVZhpzLDssHBnQgM1YMON0Sfk8iubUjsDobZK8+5wCDLq8f+IVyHYLuWk1apfyoOEwtD/WfZm7xdOwh3ZzptJ00FGXIJxMT8dHtvp3uYwzzlPbPDwFBBgrhzFJOEu91m+WUZKkYexBEA5kMYtJyv1oWNVWjImHOhRZZ5XAGjyT9lZKCEtO0h7tC8udE9kf2IBprOSH2IBxDSPCg8EDfrQo86MbmNoW1LON1L034gerVVOa0wfx3ryf6z/QO4vC6DJwVmUlWyGmw7W25Pdo/QMTMaTbyAIAAA==",
"isBase64Encoded": True, "isBase64Encoded": True,
} }
print(lambda_handler(payload, {})) print(lambda_handler(payload, {}))