INNER CODE UNIT · Python
_is_google_maps_url
georgekhananaev/google-reviews-scraper-pro · api_server.py:223
def _is_google_maps_url(url: str) -> bool:
"""Minimal allowlist check — prevents arbitrary URLs from being queued."""
from urllib.parse import urlparse
try:
host = (urlparse(url).hostname or "").lower()
except Exception: # noqa: BLE001
return False
return host in _GOOGLE_MAPS_HOSTS or any(host.endswith("." + h) for h in _GOOGLE_MAPS_HOSTS)
class DateFilterRequest(BaseModel):
"""Optional date-range filter for scrape jobs (issue #19)."""
after: Optional[str] = Field(None, description="ISO date; include reviews on/after")
before: Optional[str] = Field(None, description="ISO date; include reviews on/before")
mode: Optional[str] = Field(None, description="post_filter (default) or early_stop")
on_unparseable_date: Optional[str] = Field(None, description="include (default) or exclude")
timezone: Optional[str] = Field(None, description="IANA timezone (default UTC)")