From 869ec03baa258a796ad8f4e1ee2ab926f3141036 Mon Sep 17 00:00:00 2001 From: patnr Date: Tue, 26 Sep 2023 14:16:12 +0200 Subject: [PATCH] Fix stackoverflow.com reject requests w/o user-agent --- tests/test_all.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/test_all.py b/tests/test_all.py index 2548cb2..fb6f214 100755 --- a/tests/test_all.py +++ b/tests/test_all.py @@ -28,7 +28,8 @@ def _report_error(msg): def _link_is_down(link): try: - request = urllib.request.Request(link, method="HEAD") + request = urllib.request.Request( + link, method="HEAD", headers={'User-Agent': 'Mozilla'}) response = urllib.request.urlopen(request, timeout=2) assert response.status == 200 except Exception as e: