"""门户登录与栅格查询。""" from __future__ import annotations import base64 import calendar import json import re from dataclasses import dataclass, field from urllib.parse import urljoin import httpx from cryptography.hazmat.primitives import serialization from cryptography.hazmat.primitives.asymmetric import padding from app.platform.constants import ( APP_KEY, CAS_CAPTCHA, CAS_CONFIG, CAS_LOGIN, CAS_SMS, CAS_USER, 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'