Skip to content

Instantly share code, notes, and snippets.

@sudheerchamarthi
Created November 30, 2019 16:51
Show Gist options
  • Select an option

  • Save sudheerchamarthi/3dc5beacfc436cd8dc590748f1e07459 to your computer and use it in GitHub Desktop.

Select an option

Save sudheerchamarthi/3dc5beacfc436cd8dc590748f1e07459 to your computer and use it in GitHub Desktop.
from __future__ import print_function
import base64
print('Loading function')
def lambda_handler(event, context):
output = []
print(event)
for record in event['records']:
print(record['recordId'])
payload = (base64.b64decode(record['data'])).split("|")
if payload[0] == '1':
payload[0] = 'True'
else:
payload[0] = 'False'
final_payload = '|'.join(payload)
# Do custom processing on the payload here
output_record = {
'recordId': record['recordId'],
'result': 'Ok',
'data': base64.b64encode(final_payload)
}
output.append(output_record)
print(output_record)
print('Successfully processed {} records.'.format(len(event['records'])))
return {'records': output}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment