fix(ci): identify the release feed publisher in HTTP requests

This commit is contained in:
Kevin Yue committed 2026-11-15 02:53:13 +08:00
1 parent e22aa64ba6
commit ed306bdbdc
2 files changed
+7 -2

No files matched your search

+4 -2
View File
@@ -5,7 +5,7 @@ import json
from pathlib import Path
from urllib.error import HTTPError
from urllib.parse import urlparse
from urllib.request import urlopen
from urllib.request import Request, urlopen
import xml.etree.ElementTree as ET
FEEDS = ("appcast.xml", "latest.json", "windows/latest.json", "windows/stable/appcast.xml", "windows/snapshot/appcast.xml")
@@ -18,7 +18,9 @@ def preserve(base_url: str, directory: Path, exclude: list[str]) -> None:
if relative in exclude:
continue
try:
with urlopen(base_url.rstrip("/") + "/" + relative, timeout=30) as response:
request = Request(base_url.rstrip("/") + "/" + relative,
headers={"User-Agent": "GPConnectReleasePublisher/1.0"})
with urlopen(request, timeout=30) as response:
data = response.read(1024 * 1024 + 1)
except HTTPError as error:
if error.code == 404: