Skip to content

Commit ef8190d

Browse files
mishig25claude
andauthored
fix: add follow_redirects=True to all httpx stream calls (#764)
HuggingFace now serves dataset files via CDN redirects (302), causing httpx to raise HTTPStatusError instead of following the redirect. Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 7566b95 commit ef8190d

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/doc_builder/external.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ def get_objects_map(package_name, version="main", language="en", repo_owner="hug
106106
doc_url = f"{HF_DOC_PREFIX}{package_name}/{package_version}/{language}"
107107
url = f"{doc_url}/objects.inv"
108108
try:
109-
with httpx.stream("GET", url) as request:
109+
with httpx.stream("GET", url, follow_redirects=True) as request:
110110
request.raise_for_status()
111111
with tempfile.TemporaryDirectory() as tmp_dir:
112112
tmp_file = os.path.join(tmp_dir, "objects.inv")

src/doc_builder/process_hf_docs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ def download_and_extract_zip(library_name: str, output_dir: Path, zip_filename:
121121

122122
try:
123123
print(f" Downloading {zip_url}...")
124-
with httpx.stream("GET", zip_url) as response:
124+
with httpx.stream("GET", zip_url, follow_redirects=True) as response:
125125
response.raise_for_status()
126126

127127
# Get total size for progress bar

0 commit comments

Comments
 (0)