feat: validate google maps scrape and reviews URLs

This commit is contained in:
CREDO23 2026-07-23 18:52:39 +02:00
parent a5ccd40387
commit 9e04eb2b89
2 changed files with 4 additions and 2 deletions

View file

@ -10,6 +10,7 @@ from typing import Literal
from pydantic import BaseModel, Field, model_validator from pydantic import BaseModel, Field, model_validator
from app.capabilities.core.validation import HttpUrlStr
from app.proprietary.platforms.google_maps import ReviewItem from app.proprietary.platforms.google_maps import ReviewItem
MAX_MAPS_REVIEW_SOURCES = 20 MAX_MAPS_REVIEW_SOURCES = 20
@ -17,7 +18,7 @@ MAX_MAPS_REVIEW_SOURCES = 20
class ReviewsInput(BaseModel): class ReviewsInput(BaseModel):
urls: list[str] = Field( urls: list[HttpUrlStr] = Field(
default_factory=list, default_factory=list,
max_length=MAX_MAPS_REVIEW_SOURCES, max_length=MAX_MAPS_REVIEW_SOURCES,
description=( description=(

View file

@ -10,6 +10,7 @@ from __future__ import annotations
from pydantic import BaseModel, Field, model_validator from pydantic import BaseModel, Field, model_validator
from app.capabilities.core.validation import HttpUrlStr
from app.proprietary.platforms.google_maps import PlaceItem from app.proprietary.platforms.google_maps import PlaceItem
MAX_MAPS_SOURCES = 20 MAX_MAPS_SOURCES = 20
@ -26,7 +27,7 @@ class ScrapeInput(BaseModel):
"(at least one is required). Pair with location to scope a search." "(at least one is required). Pair with location to scope a search."
), ),
) )
urls: list[str] = Field( urls: list[HttpUrlStr] = Field(
default_factory=list, default_factory=list,
max_length=MAX_MAPS_SOURCES, max_length=MAX_MAPS_SOURCES,
description=( description=(