Skip to content

Instantly share code, notes, and snippets.

@junkangli
Last active January 22, 2020 03:46
Show Gist options
  • Save junkangli/3f95e2ed9c0b54849f49e4bc377d5f6e to your computer and use it in GitHub Desktop.
Save junkangli/3f95e2ed9c0b54849f49e4bc377d5f6e to your computer and use it in GitHub Desktop.
Python code that makes a http call to specified url. This may be used to create a AWS Python 3.8 Lambda Function to test the network connectivity to a remote site.
import logging
from urllib.request import urlopen
logger = logging.getLogger()
logger.setLevel(logging.INFO)
SITE = 'http://www.google.com'
def lambda_handler(event, context):
response = urlopen(SITE)
logger.info(response.read().decode("utf-8"));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment