Author SHA1 Message Date
FloweyntandClaude Opus 4.6 091cd27af8 ci: log gitea API error responses
diff-pr / dix (pull_request) Successful in 6m29s
flake-check / flake-check (pull_request) Successful in 52s
lint / lint (pull_request) Successful in 1m49s
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016tGMoEdMRnHsABmDbK3H7o
2026-09-11 20:55:44 +00:00
+3
View File
@@ -33,8 +33,11 @@ def gitea(method, path, body=None):
req.add_header("Authorization", f'token {os.environ["GH_TOKEN"]}') req.add_header("Authorization", f'token {os.environ["GH_TOKEN"]}')
if data is not None: if data is not None:
req.add_header("Content-Type", "application/json") req.add_header("Content-Type", "application/json")
try:
with urllib.request.urlopen(req) as resp: with urllib.request.urlopen(req) as resp:
raw = resp.read() raw = resp.read()
except urllib.error.HTTPError as e:
sys.exit(f"gitea {method} {path}: {e.code} {e.reason}\n{e.read().decode()}")
return json.loads(raw) if raw else None return json.loads(raw) if raw else None