fix: 即席查询从登记过的入口续票据,有效必须能进入查询

This commit is contained in:
2026-11-10 09:01:20 +08:00
parent 6140ca3d39
commit e3d7a05e0e
6 changed files with 75 additions and 28 deletions
+9 -4
View File
@@ -15,6 +15,7 @@ from app.nqi.constants import ORIGIN
ADHOC = f"{ORIGIN}/pro-adhoc"
PAGE = f"{ADHOC}/adhocquery"
ENTRY = f"{ADHOC}/index"
PAGE_SIZE = 200
MAX_PAGES = 2000
TIME_MODES = {"prev_month", "prev_week", "prev_day", "prev_weeks", "prev_months", "prev_days"}
@@ -55,14 +56,18 @@ def _end(day: date) -> datetime:
async def ensure_session(client: NqiClient) -> None:
"""门户凭证有效时,还要先打开即席查询,才会拿到这个应用自己的会话。"""
"""单点入口是 /pro-adhoc/index。票据有效时,这里会换成即席查询自己的会话。"""
response = await client._request(
"GET",
PAGE,
headers={"Referer": f"{ORIGIN}/pro-portal/"},
ENTRY,
headers={
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
"Referer": f"{ORIGIN}/pro-portal/",
"Upgrade-Insecure-Requests": "1",
},
check_auth=False,
)
if _landed_on_login(response):
if response.status_code >= 400 or _landed_on_login(response):
raise NqiAuthError("登录已失效,请重新登录")