Skip to content

Commit 2ffc98b

Browse files
committed
generate_refs.py: set custom user agent header
Avoids forbidden requests from kernel.org. https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/ User-Agent Signed-off-by: Daniel Gomez <[email protected]>
1 parent fdaa511 commit 2ffc98b

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

scripts/generate_refs.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,9 @@ def kreleases(args) -> None:
302302

303303
reflist = []
304304
if _check_connection("kernel.org", 80):
305-
with urllib.request.urlopen("https://www.kernel.org/releases.json") as url:
305+
_url = "https://www.kernel.org/releases.json"
306+
req = urllib.request.Request(_url, headers={"User-Agent": "Mozilla/5.0"})
307+
with urllib.request.urlopen(req) as url:
306308
data = json.load(url)
307309

308310
for release in data["releases"]:

0 commit comments

Comments
 (0)