fix: HydroAdapter 加浏览器 UA(HydroOJ 拒绝 httpx 默认 UA 403)
这个提交包含在:
@@ -37,7 +37,15 @@ class HydroAdapter(BaseJudgeEngine):
|
||||
return self._client
|
||||
if not self.username or not self.password:
|
||||
raise JudgeError("HydroOJ 服务账号未配置(HYDRO_USER / HYDRO_PASS)")
|
||||
client = httpx.AsyncClient(base_url=self.base_url, timeout=30, follow_redirects=True)
|
||||
client = httpx.AsyncClient(
|
||||
base_url=self.base_url,
|
||||
timeout=30,
|
||||
follow_redirects=True,
|
||||
headers={
|
||||
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0 Safari/537.36",
|
||||
"Accept": "text/html,application/json,*/*",
|
||||
},
|
||||
)
|
||||
# 1. 取登录页 csrf
|
||||
r = await client.get("/login")
|
||||
r.raise_for_status()
|
||||
|
||||
在新工单中引用
屏蔽一个用户