Lightweight coding agent that runs in your terminal
Rust
Set a User-Agent for package archive downloads (#52177)
Michael Bolinbc1f22455d1f
diff --git a/scripts/codex_package/dotslash.py b/scripts/codex_package/dotslash.pyindex ba0adbe244..8b2d6bcde3 100644--- a/scripts/codex_package/dotslash.py+++ b/scripts/codex_package/dotslash.py@@ -11,7 +11,7 @@ import zipfilefrom dataclasses import dataclassfrom pathlib import Pathfrom urllib.parse import urlparse-from urllib.request import urlopen+from urllib.request import Request, urlopenfrom .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)