Skip to content

Instantly share code, notes, and snippets.

@thomaslorentsen
Created October 5, 2020 12:38
Show Gist options
  • Save thomaslorentsen/e915d96b3a0d82eb241ba80e291ba95a to your computer and use it in GitHub Desktop.
Save thomaslorentsen/e915d96b3a0d82eb241ba80e291ba95a to your computer and use it in GitHub Desktop.
Test connection with Python 2.7 Lambda
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