34 lines
1.2 KiB
Python
34 lines
1.2 KiB
Python
import json, urllib.request, ssl, os, sys, urllib.error
|
|
|
|
ctx = ssl.create_default_context()
|
|
ctx.check_hostname = False
|
|
ctx.verify_mode = ssl.CERT_NONE
|
|
sys.stdout.reconfigure(encoding='utf-8')
|
|
|
|
with open(r'.orchestrator/drafts/56_stage_problem-review_claude_r3.md', 'r', encoding='utf-8') as f:
|
|
body = f.read()
|
|
|
|
payload = json.dumps({'body': body}).encode('utf-8')
|
|
req = urllib.request.Request(
|
|
'https://gitea.hmac.kr/api/v1/repos/Kyeongmin/C.E.L_Slide_test2/issues/56/comments',
|
|
data=payload,
|
|
headers={
|
|
'Authorization': 'token ' + os.environ.get('GITEA_TOKEN', ''),
|
|
'Content-Type': 'application/json',
|
|
},
|
|
method='POST',
|
|
)
|
|
try:
|
|
with urllib.request.urlopen(req, context=ctx, timeout=60) as r:
|
|
resp_bytes = r.read()
|
|
data = json.loads(resp_bytes)
|
|
print('STATUS:', r.status)
|
|
print('COMMENT_ID:', data.get('id'))
|
|
print('HTML_URL:', data.get('html_url'))
|
|
print('CREATED_AT:', data.get('created_at'))
|
|
print('BODY_LEN:', len(data.get('body', '')))
|
|
except urllib.error.HTTPError as e:
|
|
print('HTTP_ERR:', e.code, e.read().decode('utf-8', errors='replace'))
|
|
except Exception as e:
|
|
print('ERR:', repr(e))
|