Skip to content

Commit 337ebf7

Browse files
committed
download: do not set agent for weblate site downloads
1 parent 20367f4 commit 337ebf7

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/builder/downloadfile.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,15 @@ def urlopen_with_retry(self, url):
3232
timeout = TIMEOUT
3333
for ntry in range(NTRIES):
3434
try:
35+
if "hosted.weblate.org" in url:
36+
headers = {}
37+
else:
38+
headers = {
39+
"User-Agent": "Mozilla/5.0 (X11; Linux x86_64;) Gecko Firefox"
40+
}
3541
req = Request(
3642
url,
37-
headers={
38-
"User-Agent": "Mozilla/5.0 (X11; Linux x86_64;) Gecko Firefox"
39-
},
43+
headers=headers,
4044
)
4145
return urlopen(req, timeout=timeout)
4246
except HTTPError as e:

0 commit comments

Comments
 (0)