commit | 63d4bd9535056b0ea477909c1782a2d9b91d105d | [log] [tgz] |
---|---|---|
author | Luke Aguilar <llogin@rdxip.com> | Tue Jan 16 00:19:41 2024 +1100 |
committer | GitHub <noreply@github.com> | Mon Jan 15 14:19:41 2024 +0100 |
tree | 02ce1c80256d4f29ce54b4acae9f8e2a40befb9c | |
parent | 41723a3249c68ba83c635ec35663b8331584dbea [diff] |
User agent added to module downloading (#1851) User agent added to module downloading to prevent failures on sites that check and 403 against requests that don't have a user agent. For example, https://developer.x-plane.com/wp-content/plugins/code-sample-generation/sample_templates/XPSDK401.zip
diff --git a/buildkite/bazel-central-registry/bcr_presubmit.py b/buildkite/bazel-central-registry/bcr_presubmit.py index 60289d2..a413ec0 100755 --- a/buildkite/bazel-central-registry/bcr_presubmit.py +++ b/buildkite/bazel-central-registry/bcr_presubmit.py
@@ -171,7 +171,8 @@ def download(url, file): - with urllib.request.urlopen(url) as response: + req = urllib.request.Request(url, headers={'User-Agent': 'Mozilla/5.0'}) + with urllib.request.urlopen(req) as response: with open(file, "wb") as f: f.write(response.read())