#!/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
All coments