Skip to content

Commit fe47847

Browse files
authored
Fix fetch_kernel to bypass bot check
1 parent 644dbbc commit fe47847

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

gen_syscalls.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from ctags import CTags, TagEntry
22
from pathlib import Path
33
from lxml import html
4-
from urllib.request import urlopen
4+
from urllib.request import Request, urlopen
55
from shutil import copyfileobj
66
from pathlib import Path
77
from tempfile import TemporaryDirectory
@@ -21,7 +21,8 @@ def fetch_kernel(tmpdir):
2121
filename = linux_url.split('/')[-1]
2222
tmpfile = Path(tmpdir.name) / filename
2323

24-
with urlopen(linux_url) as fsrc, open(tmpfile, 'wb+') as fdst:
24+
req = Request(linux_url, headers={'User-Agent': 'Wget/1.21.4'})
25+
with urlopen(req) as fsrc, open(tmpfile, 'wb+') as fdst:
2526
copyfileobj(fsrc, fdst)
2627

2728
with tarfile.open(tmpfile) as tar:

0 commit comments

Comments
 (0)