Spaces:
Sleeping
Sleeping
Update app/core/service/playwright/models.py
Browse files
app/core/service/playwright/models.py
CHANGED
@@ -2,7 +2,7 @@ from __future__ import annotations
|
|
2 |
|
3 |
from typing import Literal
|
4 |
|
5 |
-
from pydantic import BaseModel, Field, HttpUrl
|
6 |
|
7 |
|
8 |
class ViewPortModel(BaseModel):
|
@@ -22,20 +22,8 @@ class GetContentModel(BaseModel):
|
|
22 |
url: HttpUrl
|
23 |
new_browser: bool | None = False
|
24 |
query_selector: str | None = None
|
25 |
-
wait_selector: bool | None = False
|
26 |
ms_delay: float = Field(default=0.0, gt=-1, lt=15_000.1)
|
27 |
|
28 |
-
@field_validator("wait_selector")
|
29 |
-
@classmethod
|
30 |
-
def check_query_selector(cls, v: bool | None, info: ValidationInfo) -> bool | None:
|
31 |
-
if v is True and info.data.get("query_selector") is None:
|
32 |
-
msg = "wait_selector cannot be set to True without specifying a query_selector"
|
33 |
-
raise ValueError(
|
34 |
-
msg,
|
35 |
-
)
|
36 |
-
return v
|
37 |
-
|
38 |
|
39 |
class ScreenshotModel(GetContentModel):
|
40 |
full_page: bool | None = False
|
41 |
-
|
|
|
2 |
|
3 |
from typing import Literal
|
4 |
|
5 |
+
from pydantic import BaseModel, Field, HttpUrl
|
6 |
|
7 |
|
8 |
class ViewPortModel(BaseModel):
|
|
|
22 |
url: HttpUrl
|
23 |
new_browser: bool | None = False
|
24 |
query_selector: str | None = None
|
|
|
25 |
ms_delay: float = Field(default=0.0, gt=-1, lt=15_000.1)
|
26 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
27 |
|
28 |
class ScreenshotModel(GetContentModel):
|
29 |
full_page: bool | None = False
|
|