Skip to content

Instantly share code, notes, and snippets.

@djg07
Created August 22, 2019 00:36
Show Gist options
  • Save djg07/678f7aea58b6c5b8d93c15af8577e0f2 to your computer and use it in GitHub Desktop.
Save djg07/678f7aea58b6c5b8d93c15af8577e0f2 to your computer and use it in GitHub Desktop.
import json
print('Loading function')
def lambda_handler(event, context):
#1. Parse out query string params
transactionId = event['queryStringParameters']['transactionId']
transactionType = event['queryStringParameters']['type']
transactionAmount = event['queryStringParameters']['amount']
print('transactionId=' + transactionId)
print('transactionType=' + transactionType)
print('transactionAmount=' + transactionAmount)
#2. Construct the body of the response object
transactionResponse = {}
transactionResponse['transactionId'] = transactionId
transactionResponse['type'] = transactionType
transactionResponse['amount'] = transactionAmount
transactionResponse['message'] = 'Hello from Lambda land'
#3. Construct http response object
responseObject = {}
responseObject['statusCode'] = 200
responseObject['headers'] = {}
responseObject['headers']['Content-Type'] = 'application/json'
responseObject['body'] = json.dumps(transactionResponse)
#4. Return the response object
return responseObject
@shivanshu-c20y
Copy link

Thanks man!

@farhat91
Copy link

thanks

@ddtdanilo
Copy link

Thank! So cool your video. It just work

@jaredpintar
Copy link

Thank you Daniel

@ankurbhatia24
Copy link

Thanks

@danilosilvase
Copy link

Thanks.

@NavneetSajwan
Copy link

I folowed your tutorial on youtube. getting internal server error

@AsadBukharee
Copy link

Thank you

@zhao-binxiang
Copy link

I folowed your tutorial on youtube. getting internal server error

Same here. Does anyone know the solution?

@henninb
Copy link

henninb commented Aug 6, 2023

Works perfectly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment