Solution: Check HTTP connectivity and TLS certs - Python

Development | Programming languages
Price

Price: 5.00 EUR

30-Day Money-Back Guarantee
Description
#!/usr/bin/python
from requests import get
from argparse import ArgumentParser
from os.path import exists
from checktls import check_cert

def __get_args():
    parser = ArgumentParser(description='Check HTTP connectivity and TLS certs')
    parser.add_argument('url', help='URL to hit')
    parser.add_argument('output', help='path to output file')
    args = parser.parse_args()
    return args

def __get_data(url):
    resp = get(url)
    http_code = resp.status_code
    response_time = resp.elapsed.microseconds / 1000000.
    base_host = resp.request.url[:-len(resp.request.path_url)]
    if base_host.startswith('http'):
        base_host = base_host.split('/')[-1]
    error, days_left = check_cert(base_host)
    is_ok = error == 0
Attachments
No attachments.
Solutions
You must purchase this solution to view the solution.
What masters said
You need to purchase this solution to comment on the solution.
All comments
This solution has not been commented yet.
We use cookies to give you the best possible experience on our site. By continuing to use the site you agree to our use of cookies. Find out more Accept