Skip to content

Commit e0903e4

Browse files
committed
enh: don't verify TLS certificates when checking URLs
1 parent 498893b commit e0903e4

1 file changed

Lines changed: 16 additions & 1 deletion

File tree

afm-list-manager.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
import pathlib
44
import sys
55
from urllib.parse import urlparse
6+
import urllib3
7+
import warnings
68

79
import click
810
import requests
@@ -323,7 +325,20 @@ def verify_url(url):
323325
ALIVE_BUT_BLOCKING = {401, 403, 405, 406, 429}
324326

325327
try:
326-
request = requests.head(url, headers=headers, allow_redirects=True, timeout=15)
328+
with warnings.catch_warnings():
329+
warnings.simplefilter(
330+
"ignore",
331+
category=urllib3.connectionpool.InsecureRequestWarning
332+
)
333+
request = requests.head(url,
334+
headers=headers,
335+
# DOIs often redirect
336+
allow_redirects=True,
337+
# CI systems might need some time
338+
timeout=15,
339+
# Out of scope to check SSL certificates
340+
verify=False,
341+
)
327342
if request.status_code in ALIVE_BUT_BLOCKING:
328343
request = requests.get(
329344
url,

0 commit comments

Comments
 (0)