schemas.py 871 B

1234567891011121314151617181920212223242526272829303132
  1. from typing import Any, Literal, Optional
  2. from pydantic import BaseModel, Field, HttpUrl
  3. WaitUntilValue = Literal["load", "domcontentloaded", "networkidle", "commit"]
  4. class VisitRequest(BaseModel):
  5. url: HttpUrl
  6. screenshot: bool = False
  7. waitUntil: WaitUntilValue = Field(default="load")
  8. waitTime: int = Field(
  9. default=0,
  10. ge=0,
  11. le=60,
  12. description=(
  13. "Extra seconds to wait AFTER waitUntil resolves. "
  14. "Useful for SPAs (e.g. MercadoLibre) that need extra time to hydrate polycards "
  15. "after the network goes idle. Max 60s."
  16. ),
  17. )
  18. proxy: Optional[str] = None
  19. proxyAuth: Optional[dict[str, Any]] = None
  20. incognito: bool = False
  21. class ArasResponse(BaseModel):
  22. status: str
  23. message: str
  24. data: Any = None
  25. extra: Any = None
  26. code: str = "UNKNOWN_CODE"