fix: add wait_for_images option to screenshot endpoint (#1792)

From PR #1792 by @Br1an67
This commit is contained in:
unclecode
2026-03-07 06:15:54 +00:00
parent c73aa271ac
commit d229beeaf8
2 changed files with 2 additions and 1 deletions

View File

@@ -73,6 +73,7 @@ class HTMLRequest(BaseModel):
class ScreenshotRequest(BaseModel):
url: str
screenshot_wait_for: Optional[float] = 2
wait_for_images: Optional[bool] = False
output_path: Optional[str] = None
class PDFRequest(BaseModel):

View File

@@ -404,7 +404,7 @@ async def generate_screenshot(
validate_url_scheme(body.url)
crawler = None
try:
cfg = CrawlerRunConfig(screenshot=True, screenshot_wait_for=body.screenshot_wait_for)
cfg = CrawlerRunConfig(screenshot=True, screenshot_wait_for=body.screenshot_wait_for, wait_for_images=body.wait_for_images)
crawler = await get_crawler(get_default_browser_config())
results = await crawler.arun(url=body.url, config=cfg)
if not results[0].success: