Fix cover page: replace 'requests' with 'httpx' to avoid missing dependency
Mirror and run GitLab CI / build (push) Has been cancelled
Ruff / ruff (push) Has been cancelled

This commit is contained in:
admin
2026-06-20 02:35:11 +00:00
parent 0a038d9e74
commit 0db7dcd677
+4 -4
View File
@@ -21,7 +21,7 @@ Environment variables:
import os
import io
import requests
import httpx
from datetime import datetime
from typing import Optional
from docx import Document
@@ -65,9 +65,9 @@ def _add_page_break(doc: Document):
def _download_image_bytes(url: str) -> Optional[bytes]:
"""Download image from URL and return bytes, or None on failure."""
try:
r = requests.get(url, timeout=10)
if r.status_code == 200:
return r.content
with httpx.stream("GET", url, timeout=10) as resp:
if resp.status_code == 200:
return resp.content
except Exception:
pass
return None