diff --git a/scripts/test_urls.py b/scripts/test_urls.py index 31a825042b0a3cab3d4e6f124af1b8a96fdaf724..1a984259c3762d2a52fd5f13c830851cfb1a462c 100755 --- a/scripts/test_urls.py +++ b/scripts/test_urls.py @@ -11,6 +11,7 @@ import sys import traceback from urllib.parse import urlparse import urllib3 +import time import fnmatch EXCLUDE = [ @@ -84,6 +85,7 @@ broken = 0 for url in urls: print("%s : " %(url), end='') sys.stdout.flush() + start = time.perf_counter() status = None try: resp = requests.head(url, headers=headers, allow_redirects=True, timeout=60, verify=False) @@ -101,12 +103,11 @@ for url in urls: resp.close() except Exception as e: status = False + end = time.perf_counter() - if status: - print("OK") - else: - print("Fail") + if not status: broken += 1 + print(url, "OK" if status else "FAIL", f"{end - start:0.4f}s") print("Found %d broken URLs in %d tested" %(broken, len(urls)))