'Get URL with authentication by AWS Cloudwatch Syntetic Canary function
We use AWS Cloudwatch Syntetic Canary to test the availability of our apps URLs by sending GET requests. Now, I would like to monitor a URL but this URL needs a key ID for authentication to get 200 response. Here is a simple get request to a URL without authentication:
from aws_synthetics.selenium import synthetics_webdriver as syn_webdriver
from aws_synthetics.common import synthetics_logger as logger
def main():
url = "http://google.com"
# Set screenshot option
takeScreenshot = True
browser = syn_webdriver.Chrome()
browser.get(url)
if takeScreenshot:
browser.save_screenshot("loaded.png")
response_code = syn_webdriver.get_http_response(url)
if not response_code or response_code < 200 or response_code > 299:
raise Exception("Failed to load page!")
logger.info("Canary successfully executed")
def handler(event, context):
# user defined log statements using synthetics_logger
logger.info("Selenium Python heartbeat canary")
return main()
How to make the Get request and provide the key for authentication using python Selenium? Thank you
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
