I wrote the following code:
import asyncio
loop = asyncio.get_event_loop()
async def get_urls(event):
return {'msg':'Hello World'}
def lambda_handler(event,context):
return loop.run_until_complete(get_urls(event))
I was trying to accomplish the following but faster.
def lambda_handler(event, context):
# TODO implement
return {'msg':'Hello World'}
What was the correct way to write this in an AWS Lambda environment?
Works for me... You need to choose Runtime "Python 3.6" or "Python 3.7".
import asyncio
loop = asyncio.get_event_loop()
async def get_urls(event):
return {'msg':'Hello World'}
def lambda_handler(event, context):
return loop.run_until_complete(get_urls(event))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With