Persisted QR-code payment task.
| 190 | return normalized |
| 191 | |
| 192 | @field_validator("cookies", mode="before") |
| 193 | @classmethod |
| 194 | def validate_cookies(cls, value: Any) -> dict[str, str]: |
| 195 | if value in (None, ""): |
| 196 | return {} |
| 197 | if not isinstance(value, dict): |
| 198 | raise ValueError("cookies 必须是对象") |
| 199 | return {str(key): str(item) for key, item in value.items()} |
| 200 | |
| 201 | @model_validator(mode="after") |
| 202 | def validate_auth(self) -> "AccountImportRequest": |
| 203 | has_auth = bool((self.token or "").strip() or (self.cookie_header or "").strip() or self.cookies) |
| 204 | if not has_auth: |
| 205 | raise ValueError("必须提供 token、cookie_header 或 cookies 之一") |
| 206 | return self |
| 207 | |
| 208 | |
| 209 | class ManualCaptchaRequest(BaseModel): |
| 210 | """Manual captcha ticket storage payload.""" |
| 211 | |
| 212 | model_config = ConfigDict(extra="ignore") |
| 213 | |
| 214 | ticket: str |