Created
September 3, 2019 02:03
-
-
Save umihico/b920625e9c61f955cd604c0ca626ef98 to your computer and use it in GitHub Desktop.
AWS Lambda function to return image
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
import base64 | |
def lambda_handler(event, content): | |
response = requests.get("https://github.com/umihico.png") | |
return { | |
"isBase64Encoded": True, | |
"statusCode": 200, | |
"headers": { "content-type": "image/jpg"}, | |
"body": base64.b64encode(response.content).decode("utf-8") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment