Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
c48c666309
commit
64e152de3c
1 file changed
+5
-2
@@ -21,6 +21,7 @@ from pathlib import Path
|
||||
|
||||
ASSETS = ("t5deRenderEngine.dll", "t5de-renderer.exe")
|
||||
NIGHTLY_TAG = "nightly"
|
||||
USER_AGENT = "t5de-release (https://git.t5de.dev/t5de/t5de-renderer, 1)"
|
||||
RELEASE_TAG = re.compile(r"v(\d+)\.(\d+)\.(\d+)")
|
||||
|
||||
|
||||
@@ -52,7 +53,9 @@ class Gitea:
|
||||
if body is not None:
|
||||
data = json.dumps(body).encode()
|
||||
req = urllib.request.Request(self.api + path, method=method, data=data,
|
||||
headers={"Authorization": f"token {self.token}", "Content-Type": content_type})
|
||||
# Cloudflare in front of the server refuses Python's default User-Agent.
|
||||
headers={"Authorization": f"token {self.token}", "Content-Type": content_type,
|
||||
"User-Agent": USER_AGENT})
|
||||
try:
|
||||
with urllib.request.urlopen(req, timeout=120) as response:
|
||||
text = response.read()
|
||||
@@ -131,7 +134,7 @@ def announce(webhook: str, info: dict[str, str], release: dict, previous: str |
|
||||
"description": description[:4000], "color": 0xFFD200}]}
|
||||
req = urllib.request.Request(webhook, method="POST", data=json.dumps(body).encode(),
|
||||
headers={"Content-Type": "application/json",
|
||||
"User-Agent": "t5de-release (https://git.t5de.dev/t5de/t5de-renderer, 1)"})
|
||||
"User-Agent": USER_AGENT})
|
||||
try:
|
||||
urllib.request.urlopen(req, timeout=30).close()
|
||||
print("Announced on Discord")
|
||||
|
||||
Reference in new issue
Block a user