Skip to content
Snippets Groups Projects
Commit 91549fbb authored by Emanuele Aina's avatar Emanuele Aina
Browse files

test_urls: Print timings


Signed-off-by: Emanuele Aina's avatarEmanuele Aina <emanuele.aina@collabora.com>
parent d5330388
No related branches found
No related tags found
1 merge request!279URL checker tweaks
......@@ -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)))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment