Commit 9e3da200 authored by Mikaël Salson's avatar Mikaël Salson

tools/validate-links.py: Use User-Agent to prevent from being blocked of some sites

Fix #4131
parent b800d85a
Pipeline #146726 passed with stages
in 3 minutes and 6 seconds
......@@ -21,6 +21,8 @@ STATUS = {
True: 'ok'
}
USER_AGENT = {'User-Agent': 'Mozilla/5.0'}
stats = defaultdict(int)
failed = []
......@@ -36,7 +38,7 @@ def check_url(url, ids=[]):
# External http(s) links
try:
req = requests.get(url)
req = requests.get(url, headers = USER_AGENT)
return (req.status_code < 400)
except:
return False
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment