Last active
January 22, 2020 03:46
-
-
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.
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 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