Previously, we were doing this in a mapping template within AWS,
but I decided that that mechanism was more trouble that it was
worth, (it was quite buried in AWS, hard to share across multiple
lambdas, and meanwhile this approach is a single line of code).
+from urllib.parse import parse_qs
from turbot.rot import rot
def turbot_lambda(event, context):
Currently only calls into the rot() function but may become more
sophisticated later on."""
- return rot(event['text'])
+ body = parse_qs(event['body'])
+ result = rot(body['text'][0])
+
+ return {
+ 'statusCode': 200,
+ 'body': result
+ }