diff --git a/scripts/codex_package/dotslash.py b/scripts/codex_package/dotslash.py index ba0adbe244..8b2d6bcde3 100644 --- a/scripts/codex_package/dotslash.py +++ b/scripts/codex_package/dotslash.py @@ -11,7 +11,7 @@ import zipfile from dataclasses import dataclass from pathlib import Path from urllib.parse import urlparse -from urllib.request import urlopen +from urllib.request import Request, urlopen from .targets import TargetSpec @@ -168,7 +168,8 @@ def download_archive(url: str, archive_path: Path) -> None: temp_path = archive_path.with_suffix(f"{archive_path.suffix}.tmp") temp_path.unlink(missing_ok=True) try: - with urlopen(url, timeout=DOWNLOAD_TIMEOUT_SECS) as response: + request = Request(url, headers={"User-Agent": "codex-package"}) + with urlopen(request, timeout=DOWNLOAD_TIMEOUT_SECS) as response: with open(temp_path, "wb") as out: shutil.copyfileobj(response, out) temp_path.replace(archive_path)