JobData/app/schemas/proxy_provider.py

46 lines
1.9 KiB
Python

from datetime import datetime
from typing import Optional
from pydantic import BaseModel, Field
class ProxyProviderBase(BaseModel):
name: str = Field(description="名称")
platform: str = Field("all", description="目标平台: boss/qcwy/zhilian/all")
mode: str = Field("json", description="解析模式: json/text")
list_path: Optional[str] = Field(None, description="JSON列表路径")
ip_path: Optional[str] = Field(None, description="IP字段路径")
port_path: Optional[str] = Field(None, description="端口字段路径")
username_path: Optional[str] = Field(None, description="用户名字段路径")
password_path: Optional[str] = Field(None, description="密码字段路径")
pattern: Optional[str] = Field(None, description="文本解析正则")
template: str = Field(description="最终代理模板")
class ProxyProviderCreate(ProxyProviderBase):
pass
class ProxyProviderUpdate(BaseModel):
id: int = Field(description="主键ID")
name: Optional[str] = Field(None, description="名称")
platform: Optional[str] = Field(None, description="目标平台: boss/qcwy/zhilian/all")
mode: Optional[str] = Field(None, description="解析模式: json/text")
list_path: Optional[str] = Field(None, description="JSON列表路径")
ip_path: Optional[str] = Field(None, description="IP字段路径")
port_path: Optional[str] = Field(None, description="端口字段路径")
username_path: Optional[str] = Field(None, description="用户名字段路径")
password_path: Optional[str] = Field(None, description="密码字段路径")
pattern: Optional[str] = Field(None, description="文本解析正则")
template: Optional[str] = Field(None, description="最终代理模板")
class ProxyProviderOut(ProxyProviderBase):
id: int
created_at: datetime
updated_at: datetime
class Config:
from_attributes = True