"errorMessage": "Module initialization error"
2 answers
You don't need environment variables. Just keep it simple.
from __future__ import print_function
import os
from datetime import datetime
from urllib2 import urlopen
def lambda_handler(event, context):
url = 'https://www.google.com' # change it with your own
print('Checking {} at {}...'.format(url, datetime.utcnow()))
html = urlopen(url).read()
# do some processing
return html
Here's another simple example.
from __future__ import print_function
def lambda_handler(event, context):
first = event.get('first', 0)
second = event.get('second', 0)
sum = first + second
return sum
Here is an example event that will be used to call this lambda. you can set up an event from the Lambda frontend. (or google it)
{
"first": 10,
"second": 23
}
0
source to share