Created
October 5, 2020 12:38
-
-
Save thomaslorentsen/e915d96b3a0d82eb241ba80e291ba95a to your computer and use it in GitHub Desktop.
Test connection with Python 2.7 Lambda
This file contains hidden or 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 json | |
import urllib2 | |
import ssl | |
def lambda_handler(event, context): | |
ctx = ssl.create_default_context() | |
ctx.check_hostname = False | |
ctx.verify_mode = ssl.CERT_NONE | |
req = response = urllib2.urlopen('https://server', context=ctx) | |
html = response.read() | |
return { | |
'statusCode': 200, | |
'body': json.dumps(html) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment