"""门户登录与栅格查询。""" from __future__ import annotations import asyncio import base64 import calendar import json import re from collections import deque from collections.abc import AsyncIterator from dataclasses import dataclass, field from urllib.parse import quote, urlencode, urljoin import httpx from cryptography.hazmat.primitives import serialization from cryptography.hazmat.primitives.asymmetric import padding from app.features.download.ids import normalize_id from app.platform.constants import ( APP_KEY, CAS_CAPTCHA, CAS_CONFIG, CAS_LOGIN, CAS_PASSWORD_CHECK, CAS_SMS, CAS_USER, PORTAL_ONLINE, GIS_API, GIS_PROD, ORIGIN, PORTAL_SERVICE, USER_AGENT, ) from app.platform.sign import build_sign, wfs_sig _EXECUTION = re.compile(r'name="execution"\s+value="([^"]+)"', re.I) _PUBLIC_KEY = re.compile(r'setPublicKey\("([^"]+)"\)') _FORM_ACTION = re.compile(r'