Skip to content

Instantly share code, notes, and snippets.

@Nxtra
Created July 22, 2020 18:18
Show Gist options
  • Save Nxtra/1bdcf9d737ab96008c49ef9682a0770f to your computer and use it in GitHub Desktop.
Save Nxtra/1bdcf9d737ab96008c49ef9682a0770f to your computer and use it in GitHub Desktop.
def handle(event, context):
output = []
for record in event['records']:
payload = base64.b64decode(record['data'])
result = dropped_or_okay(payload)
if result == 'Ok':
payload = preprocess_payload(payload)
output_record = {
'recordId': record['recordId'],
'result': result,
'data': base64.b64encode(json.dumps(payload).encode("utf-8")).decode("utf-8")
}
output.append(output_record)
return {'records': output}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment