Link Checker: Allow 403 status codes

Cloudflare likes to break the Internet, so we'll have to ignore
403 errors from sites in the link checker.
This commit is contained in:
rubenwardy 2024-09-05 19:19:16 +01:00
parent 5b1417f432
commit 837d0b5bc1

@ -117,6 +117,9 @@ def _url_exists(url: str) -> str:
response.raise_for_status() response.raise_for_status()
return "" return ""
except requests.exceptions.HTTPError as e: except requests.exceptions.HTTPError as e:
if e.response.status_code == 403:
return ""
print(f" - [{e.response.status_code}] <{url}>", file=sys.stderr) print(f" - [{e.response.status_code}] <{url}>", file=sys.stderr)
return str(e.response.status_code) return str(e.response.status_code)
except requests.exceptions.ConnectionError: except requests.exceptions.ConnectionError: