From f63de474dc764d19cc1d37acaf11b0d093b554fe Mon Sep 17 00:00:00 2001 From: "geonode-internal-integrations-bot[bot]" <360627573+geonode-internal-integrations-bot[bot]@users.noreply.github.com> Date: Tue, 24 Nov 2026 12:54:58 +0000 Subject: [PATCH 1/2] Sync API spec with production --- CHANGELOG.md | 6 + geonode_scraper_sdk/__init__.py | 26 + geonode_scraper_sdk/api/__init__.py | 1 + geonode_scraper_sdk/api/batch_api.py | 289 ++ geonode_scraper_sdk/api/crawl_api.py | 31 +- geonode_scraper_sdk/api/extraction_api.py | 41 +- geonode_scraper_sdk/api/google_api.py | 632 ++++ geonode_scraper_sdk/api/map_api.py | 25 +- geonode_scraper_sdk/api/search_api.py | 25 +- geonode_scraper_sdk/api/statistics_api.py | 24 +- geonode_scraper_sdk/models/__init__.py | 12 + .../models/ai_overview_model.py | 105 + geonode_scraper_sdk/models/ai_source_model.py | 88 + .../models/batch_download_response.py | 92 + .../models/extraction_error_code.py | 2 + .../models/google_search_light_page.py | 135 + .../models/google_search_light_request.py | 167 + .../models/google_search_light_response.py | 110 + .../models/google_shopping_product_request.py | 111 + .../google_shopping_product_response.py | 125 + geonode_scraper_sdk/models/search_request.py | 6 +- .../models/shopping_installment_model.py | 95 + .../models/shopping_product_model.py | 102 + .../models/shopping_promotion_model.py | 100 + .../models/shopping_seller_model.py | 247 ++ openapi.json | 3144 ++++++++++++----- 26 files changed, 4708 insertions(+), 1033 deletions(-) create mode 100644 geonode_scraper_sdk/api/google_api.py create mode 100644 geonode_scraper_sdk/models/ai_overview_model.py create mode 100644 geonode_scraper_sdk/models/ai_source_model.py create mode 100644 geonode_scraper_sdk/models/batch_download_response.py create mode 100644 geonode_scraper_sdk/models/google_search_light_page.py create mode 100644 geonode_scraper_sdk/models/google_search_light_request.py create mode 100644 geonode_scraper_sdk/models/google_search_light_response.py create mode 100644 geonode_scraper_sdk/models/google_shopping_product_request.py create mode 100644 geonode_scraper_sdk/models/google_shopping_product_response.py create mode 100644 geonode_scraper_sdk/models/shopping_installment_model.py create mode 100644 geonode_scraper_sdk/models/shopping_product_model.py create mode 100644 geonode_scraper_sdk/models/shopping_promotion_model.py create mode 100644 geonode_scraper_sdk/models/shopping_seller_model.py diff --git a/CHANGELOG.md b/CHANGELOG.md index d12b82a..c0dbee8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,12 @@ The format is inspired by Keep a Changelog. ## [Unreleased] +- Synced with the production API spec. + - New endpoints: `GET /v1/batch/{job_id}/download`, `POST /v1/google/search/light`, `POST /v1/google/shopping/product`. + - Removed request parameters: `url` on `GET /v1/crawl/jobs`, `url` on `GET /v1/extract/jobs`, `url` on `GET /v1/map/jobs`, `query` on `GET /v1/search/jobs`. + - New models: `AiOverviewModel`, `AiSourceModel`, `BatchDownloadResponse`, `GoogleSearchLightPage`, `GoogleSearchLightRequest`, `GoogleSearchLightResponse`, `GoogleShoppingProductRequest`, `GoogleShoppingProductResponse`, `ShoppingInstallmentModel`, `ShoppingProductModel`, `ShoppingPromotionModel`, `ShoppingSellerModel`. + - New enum values: `TARGET_BLOCKED` in `ExtractionErrorCode`, `GOOGLE_SEARCH_MOVED` in `ExtractionErrorCode`, `yahoo` in `SearchRequest.engine`. + - Removed enum values: `brave` in `SearchRequest.engine`. - The integrations page link and package homepage point to this integration's own page. ## [0.6.2] - 2026-10-28 diff --git a/geonode_scraper_sdk/__init__.py b/geonode_scraper_sdk/__init__.py index fcaa98a..e6c6a72 100644 --- a/geonode_scraper_sdk/__init__.py +++ b/geonode_scraper_sdk/__init__.py @@ -21,6 +21,7 @@ "BatchApi", "CrawlApi", "ExtractionApi", + "GoogleApi", "MapApi", "SearchApi", "StatisticsApi", @@ -36,9 +37,12 @@ "ApiKeyError", "ApiAttributeError", "ApiException", + "AiOverviewModel", + "AiSourceModel", "BatchAccepted", "BatchCancelled", "BatchConfig", + "BatchDownloadResponse", "BatchItemMetadata", "BatchJobsResponse", "BatchListItemResponse", @@ -69,6 +73,11 @@ "ExtractionErrorCode", "ExtractionErrorResponse", "ExtractionMetadata", + "GoogleSearchLightPage", + "GoogleSearchLightRequest", + "GoogleSearchLightResponse", + "GoogleShoppingProductRequest", + "GoogleShoppingProductResponse", "HTTPValidationError", "HealthResponse", "HealthStatus", @@ -96,6 +105,10 @@ "SearchListItemResponse", "SearchRequest", "SearchResponse", + "ShoppingInstallmentModel", + "ShoppingProductModel", + "ShoppingPromotionModel", + "ShoppingSellerModel", "StatisticsResponse", "TokensUsageResponse", "ValidationError", @@ -113,6 +126,7 @@ from geonode_scraper_sdk.api.batch_api import BatchApi as BatchApi from geonode_scraper_sdk.api.crawl_api import CrawlApi as CrawlApi from geonode_scraper_sdk.api.extraction_api import ExtractionApi as ExtractionApi +from geonode_scraper_sdk.api.google_api import GoogleApi as GoogleApi from geonode_scraper_sdk.api.map_api import MapApi as MapApi from geonode_scraper_sdk.api.search_api import SearchApi as SearchApi from geonode_scraper_sdk.api.statistics_api import StatisticsApi as StatisticsApi @@ -132,9 +146,12 @@ from geonode_scraper_sdk.exceptions import ApiException as ApiException # import models into sdk package +from geonode_scraper_sdk.models.ai_overview_model import AiOverviewModel as AiOverviewModel +from geonode_scraper_sdk.models.ai_source_model import AiSourceModel as AiSourceModel from geonode_scraper_sdk.models.batch_accepted import BatchAccepted as BatchAccepted from geonode_scraper_sdk.models.batch_cancelled import BatchCancelled as BatchCancelled from geonode_scraper_sdk.models.batch_config import BatchConfig as BatchConfig +from geonode_scraper_sdk.models.batch_download_response import BatchDownloadResponse as BatchDownloadResponse from geonode_scraper_sdk.models.batch_item_metadata import BatchItemMetadata as BatchItemMetadata from geonode_scraper_sdk.models.batch_jobs_response import BatchJobsResponse as BatchJobsResponse from geonode_scraper_sdk.models.batch_list_item_response import BatchListItemResponse as BatchListItemResponse @@ -165,6 +182,11 @@ from geonode_scraper_sdk.models.extraction_error_code import ExtractionErrorCode as ExtractionErrorCode from geonode_scraper_sdk.models.extraction_error_response import ExtractionErrorResponse as ExtractionErrorResponse from geonode_scraper_sdk.models.extraction_metadata import ExtractionMetadata as ExtractionMetadata +from geonode_scraper_sdk.models.google_search_light_page import GoogleSearchLightPage as GoogleSearchLightPage +from geonode_scraper_sdk.models.google_search_light_request import GoogleSearchLightRequest as GoogleSearchLightRequest +from geonode_scraper_sdk.models.google_search_light_response import GoogleSearchLightResponse as GoogleSearchLightResponse +from geonode_scraper_sdk.models.google_shopping_product_request import GoogleShoppingProductRequest as GoogleShoppingProductRequest +from geonode_scraper_sdk.models.google_shopping_product_response import GoogleShoppingProductResponse as GoogleShoppingProductResponse from geonode_scraper_sdk.models.http_validation_error import HTTPValidationError as HTTPValidationError from geonode_scraper_sdk.models.health_response import HealthResponse as HealthResponse from geonode_scraper_sdk.models.health_status import HealthStatus as HealthStatus @@ -192,6 +214,10 @@ from geonode_scraper_sdk.models.search_list_item_response import SearchListItemResponse as SearchListItemResponse from geonode_scraper_sdk.models.search_request import SearchRequest as SearchRequest from geonode_scraper_sdk.models.search_response import SearchResponse as SearchResponse +from geonode_scraper_sdk.models.shopping_installment_model import ShoppingInstallmentModel as ShoppingInstallmentModel +from geonode_scraper_sdk.models.shopping_product_model import ShoppingProductModel as ShoppingProductModel +from geonode_scraper_sdk.models.shopping_promotion_model import ShoppingPromotionModel as ShoppingPromotionModel +from geonode_scraper_sdk.models.shopping_seller_model import ShoppingSellerModel as ShoppingSellerModel from geonode_scraper_sdk.models.statistics_response import StatisticsResponse as StatisticsResponse from geonode_scraper_sdk.models.tokens_usage_response import TokensUsageResponse as TokensUsageResponse from geonode_scraper_sdk.models.validation_error import ValidationError as ValidationError diff --git a/geonode_scraper_sdk/api/__init__.py b/geonode_scraper_sdk/api/__init__.py index 9a9ab01..b9dbafc 100644 --- a/geonode_scraper_sdk/api/__init__.py +++ b/geonode_scraper_sdk/api/__init__.py @@ -4,6 +4,7 @@ from geonode_scraper_sdk.api.batch_api import BatchApi from geonode_scraper_sdk.api.crawl_api import CrawlApi from geonode_scraper_sdk.api.extraction_api import ExtractionApi +from geonode_scraper_sdk.api.google_api import GoogleApi from geonode_scraper_sdk.api.map_api import MapApi from geonode_scraper_sdk.api.search_api import SearchApi from geonode_scraper_sdk.api.statistics_api import StatisticsApi diff --git a/geonode_scraper_sdk/api/batch_api.py b/geonode_scraper_sdk/api/batch_api.py index 6f5b429..0110e8e 100644 --- a/geonode_scraper_sdk/api/batch_api.py +++ b/geonode_scraper_sdk/api/batch_api.py @@ -22,6 +22,7 @@ from uuid import UUID from geonode_scraper_sdk.models.batch_accepted import BatchAccepted from geonode_scraper_sdk.models.batch_cancelled import BatchCancelled +from geonode_scraper_sdk.models.batch_download_response import BatchDownloadResponse from geonode_scraper_sdk.models.batch_jobs_response import BatchJobsResponse from geonode_scraper_sdk.models.batch_request import BatchRequest from geonode_scraper_sdk.models.batch_status_response import BatchStatusResponse @@ -373,6 +374,8 @@ def create_batch_v1_batch_post( _response_types_map: Dict[str, Optional[str]] = { '202': "BatchAccepted", '401': None, + '402': "ErrorResponse", + '403': "ErrorResponse", '422': None, '429': None, '503': None, @@ -444,6 +447,8 @@ def create_batch_v1_batch_post_with_http_info( _response_types_map: Dict[str, Optional[str]] = { '202': "BatchAccepted", '401': None, + '402': "ErrorResponse", + '403': "ErrorResponse", '422': None, '429': None, '503': None, @@ -515,6 +520,8 @@ def create_batch_v1_batch_post_without_preload_content( _response_types_map: Dict[str, Optional[str]] = { '202': "BatchAccepted", '401': None, + '402': "ErrorResponse", + '403': "ErrorResponse", '422': None, '429': None, '503': None, @@ -603,6 +610,288 @@ def _create_batch_v1_batch_post_serialize( + @validate_call + def download_batch_results_v1_batch_job_id_download_get( + self, + job_id: UUID, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> BatchDownloadResponse: + """Download all results of a batch as one zip + + A temporary link to a zip of a finished batch: one file per successful URL in the batch's formats and a manifest.json of the URLs without a file. Asking again returns a new link to the same archive. While the zip is still being built the answer is 202 with a Retry-After header. Not charged. + + :param job_id: (required) + :type job_id: UUID + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._download_batch_results_v1_batch_job_id_download_get_serialize( + job_id=job_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "BatchDownloadResponse", + '202': "ErrorResponse", + '401': None, + '404': "ErrorResponse", + '409': "ErrorResponse", + '410': "ErrorResponse", + '422': "HTTPValidationError", + '503': "ErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def download_batch_results_v1_batch_job_id_download_get_with_http_info( + self, + job_id: UUID, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[BatchDownloadResponse]: + """Download all results of a batch as one zip + + A temporary link to a zip of a finished batch: one file per successful URL in the batch's formats and a manifest.json of the URLs without a file. Asking again returns a new link to the same archive. While the zip is still being built the answer is 202 with a Retry-After header. Not charged. + + :param job_id: (required) + :type job_id: UUID + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._download_batch_results_v1_batch_job_id_download_get_serialize( + job_id=job_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "BatchDownloadResponse", + '202': "ErrorResponse", + '401': None, + '404': "ErrorResponse", + '409': "ErrorResponse", + '410': "ErrorResponse", + '422': "HTTPValidationError", + '503': "ErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def download_batch_results_v1_batch_job_id_download_get_without_preload_content( + self, + job_id: UUID, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Download all results of a batch as one zip + + A temporary link to a zip of a finished batch: one file per successful URL in the batch's formats and a manifest.json of the URLs without a file. Asking again returns a new link to the same archive. While the zip is still being built the answer is 202 with a Retry-After header. Not charged. + + :param job_id: (required) + :type job_id: UUID + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._download_batch_results_v1_batch_job_id_download_get_serialize( + job_id=job_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "BatchDownloadResponse", + '202': "ErrorResponse", + '401': None, + '404': "ErrorResponse", + '409': "ErrorResponse", + '410': "ErrorResponse", + '422': "HTTPValidationError", + '503': "ErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _download_batch_results_v1_batch_job_id_download_get_serialize( + self, + job_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if job_id is not None: + _path_params['job_id'] = job_id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'ApiKeyAuth' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v1/batch/{job_id}/download', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + @validate_call def get_batch_status_v1_batch_job_id_get( self, diff --git a/geonode_scraper_sdk/api/crawl_api.py b/geonode_scraper_sdk/api/crawl_api.py index 6bdd611..476014b 100644 --- a/geonode_scraper_sdk/api/crawl_api.py +++ b/geonode_scraper_sdk/api/crawl_api.py @@ -16,7 +16,7 @@ from typing_extensions import Annotated from datetime import datetime -from pydantic import Field, StrictStr +from pydantic import Field from typing import Any, Optional from typing_extensions import Annotated from uuid import UUID @@ -373,7 +373,8 @@ def create_crawl_v1_crawl_post( _response_types_map: Dict[str, Optional[str]] = { '202': "CrawlAccepted", '401': None, - '402': None, + '402': "ErrorResponse", + '403': "ErrorResponse", '422': None, '429': None, '503': None, @@ -445,7 +446,8 @@ def create_crawl_v1_crawl_post_with_http_info( _response_types_map: Dict[str, Optional[str]] = { '202': "CrawlAccepted", '401': None, - '402': None, + '402': "ErrorResponse", + '403': "ErrorResponse", '422': None, '429': None, '503': None, @@ -517,7 +519,8 @@ def create_crawl_v1_crawl_post_without_preload_content( _response_types_map: Dict[str, Optional[str]] = { '202': "CrawlAccepted", '401': None, - '402': None, + '402': "ErrorResponse", + '403': "ErrorResponse", '422': None, '429': None, '503': None, @@ -913,7 +916,6 @@ def _get_crawl_status_v1_crawl_job_id_get_serialize( @validate_call def list_crawl_jobs_v1_crawl_jobs_get( self, - url: Annotated[Optional[StrictStr], Field(description="Filter by seed URL (partial match)")] = None, status: Annotated[Optional[Any], Field(description="Filter by job status")] = None, start_date: Annotated[Optional[datetime], Field(description="Filter jobs created on or after this date")] = None, end_date: Annotated[Optional[datetime], Field(description="Filter jobs created on or before this date")] = None, @@ -936,8 +938,6 @@ def list_crawl_jobs_v1_crawl_jobs_get( List crawl jobs for the authenticated user with optional filtering and pagination - :param url: Filter by seed URL (partial match) - :type url: str :param status: Filter by job status :type status: JobStatus :param start_date: Filter jobs created on or after this date @@ -971,7 +971,6 @@ def list_crawl_jobs_v1_crawl_jobs_get( """ # noqa: E501 _param = self._list_crawl_jobs_v1_crawl_jobs_get_serialize( - url=url, status=status, start_date=start_date, end_date=end_date, @@ -985,6 +984,7 @@ def list_crawl_jobs_v1_crawl_jobs_get( _response_types_map: Dict[str, Optional[str]] = { '200': "CrawlJobsResponse", + '400': "ErrorResponse", '401': None, '422': "HTTPValidationError", } @@ -1002,7 +1002,6 @@ def list_crawl_jobs_v1_crawl_jobs_get( @validate_call def list_crawl_jobs_v1_crawl_jobs_get_with_http_info( self, - url: Annotated[Optional[StrictStr], Field(description="Filter by seed URL (partial match)")] = None, status: Annotated[Optional[Any], Field(description="Filter by job status")] = None, start_date: Annotated[Optional[datetime], Field(description="Filter jobs created on or after this date")] = None, end_date: Annotated[Optional[datetime], Field(description="Filter jobs created on or before this date")] = None, @@ -1025,8 +1024,6 @@ def list_crawl_jobs_v1_crawl_jobs_get_with_http_info( List crawl jobs for the authenticated user with optional filtering and pagination - :param url: Filter by seed URL (partial match) - :type url: str :param status: Filter by job status :type status: JobStatus :param start_date: Filter jobs created on or after this date @@ -1060,7 +1057,6 @@ def list_crawl_jobs_v1_crawl_jobs_get_with_http_info( """ # noqa: E501 _param = self._list_crawl_jobs_v1_crawl_jobs_get_serialize( - url=url, status=status, start_date=start_date, end_date=end_date, @@ -1074,6 +1070,7 @@ def list_crawl_jobs_v1_crawl_jobs_get_with_http_info( _response_types_map: Dict[str, Optional[str]] = { '200': "CrawlJobsResponse", + '400': "ErrorResponse", '401': None, '422': "HTTPValidationError", } @@ -1091,7 +1088,6 @@ def list_crawl_jobs_v1_crawl_jobs_get_with_http_info( @validate_call def list_crawl_jobs_v1_crawl_jobs_get_without_preload_content( self, - url: Annotated[Optional[StrictStr], Field(description="Filter by seed URL (partial match)")] = None, status: Annotated[Optional[Any], Field(description="Filter by job status")] = None, start_date: Annotated[Optional[datetime], Field(description="Filter jobs created on or after this date")] = None, end_date: Annotated[Optional[datetime], Field(description="Filter jobs created on or before this date")] = None, @@ -1114,8 +1110,6 @@ def list_crawl_jobs_v1_crawl_jobs_get_without_preload_content( List crawl jobs for the authenticated user with optional filtering and pagination - :param url: Filter by seed URL (partial match) - :type url: str :param status: Filter by job status :type status: JobStatus :param start_date: Filter jobs created on or after this date @@ -1149,7 +1143,6 @@ def list_crawl_jobs_v1_crawl_jobs_get_without_preload_content( """ # noqa: E501 _param = self._list_crawl_jobs_v1_crawl_jobs_get_serialize( - url=url, status=status, start_date=start_date, end_date=end_date, @@ -1163,6 +1156,7 @@ def list_crawl_jobs_v1_crawl_jobs_get_without_preload_content( _response_types_map: Dict[str, Optional[str]] = { '200': "CrawlJobsResponse", + '400': "ErrorResponse", '401': None, '422': "HTTPValidationError", } @@ -1175,7 +1169,6 @@ def list_crawl_jobs_v1_crawl_jobs_get_without_preload_content( def _list_crawl_jobs_v1_crawl_jobs_get_serialize( self, - url, status, start_date, end_date, @@ -1203,10 +1196,6 @@ def _list_crawl_jobs_v1_crawl_jobs_get_serialize( # process the path parameters # process the query parameters - if url is not None: - - _query_params.append(('url', url)) - if status is not None: _query_params.append(('status', status.value)) diff --git a/geonode_scraper_sdk/api/extraction_api.py b/geonode_scraper_sdk/api/extraction_api.py index 55a2804..e464150 100644 --- a/geonode_scraper_sdk/api/extraction_api.py +++ b/geonode_scraper_sdk/api/extraction_api.py @@ -102,6 +102,7 @@ def extract_v1_extract_post( '400': "ErrorResponse", '401': "ErrorResponse", '402': "ErrorResponse", + '403': "ExtractionErrorResponse", '422': "ExtractionErrorResponse", '429': "ErrorResponse", '500': "ErrorResponse", @@ -177,6 +178,7 @@ def extract_v1_extract_post_with_http_info( '400': "ErrorResponse", '401': "ErrorResponse", '402': "ErrorResponse", + '403': "ExtractionErrorResponse", '422': "ExtractionErrorResponse", '429': "ErrorResponse", '500': "ErrorResponse", @@ -252,6 +254,7 @@ def extract_v1_extract_post_without_preload_content( '400': "ErrorResponse", '401': "ErrorResponse", '402': "ErrorResponse", + '403': "ExtractionErrorResponse", '422': "ExtractionErrorResponse", '429': "ErrorResponse", '500': "ErrorResponse", @@ -614,8 +617,7 @@ def _get_job_result_v1_extract_job_id_get_serialize( @validate_call def list_jobs_v1_extract_jobs_get( self, - job_id: Annotated[Optional[StrictStr], Field(description="Filter by job ID")] = None, - url: Annotated[Optional[StrictStr], Field(description="Filter by target URL")] = None, + job_id: Annotated[Optional[StrictStr], Field(description="Filter by full job ID (exact match, UUID)")] = None, status: Annotated[Optional[Any], Field(description="Filter by job status")] = None, output: Annotated[Optional[Any], Field(description="Filter by output format")] = None, start_date: Annotated[Optional[datetime], Field(description="Filter jobs created on or after this date")] = None, @@ -637,12 +639,10 @@ def list_jobs_v1_extract_jobs_get( ) -> JobCollectionResponse: """List extraction jobs - List and filter extraction jobs by job ID, URL, status, output format, and date range + List and filter extraction jobs by full job ID (exact match), status, output format, and date range - :param job_id: Filter by job ID + :param job_id: Filter by full job ID (exact match, UUID) :type job_id: str - :param url: Filter by target URL - :type url: str :param status: Filter by job status :type status: JobStatus :param output: Filter by output format @@ -679,7 +679,6 @@ def list_jobs_v1_extract_jobs_get( _param = self._list_jobs_v1_extract_jobs_get_serialize( job_id=job_id, - url=url, status=status, output=output, start_date=start_date, @@ -694,6 +693,7 @@ def list_jobs_v1_extract_jobs_get( _response_types_map: Dict[str, Optional[str]] = { '200': "JobCollectionResponse", + '400': "ErrorResponse", '401': "ErrorResponse", '404': "ErrorResponse", '422': "HTTPValidationError", @@ -712,8 +712,7 @@ def list_jobs_v1_extract_jobs_get( @validate_call def list_jobs_v1_extract_jobs_get_with_http_info( self, - job_id: Annotated[Optional[StrictStr], Field(description="Filter by job ID")] = None, - url: Annotated[Optional[StrictStr], Field(description="Filter by target URL")] = None, + job_id: Annotated[Optional[StrictStr], Field(description="Filter by full job ID (exact match, UUID)")] = None, status: Annotated[Optional[Any], Field(description="Filter by job status")] = None, output: Annotated[Optional[Any], Field(description="Filter by output format")] = None, start_date: Annotated[Optional[datetime], Field(description="Filter jobs created on or after this date")] = None, @@ -735,12 +734,10 @@ def list_jobs_v1_extract_jobs_get_with_http_info( ) -> ApiResponse[JobCollectionResponse]: """List extraction jobs - List and filter extraction jobs by job ID, URL, status, output format, and date range + List and filter extraction jobs by full job ID (exact match), status, output format, and date range - :param job_id: Filter by job ID + :param job_id: Filter by full job ID (exact match, UUID) :type job_id: str - :param url: Filter by target URL - :type url: str :param status: Filter by job status :type status: JobStatus :param output: Filter by output format @@ -777,7 +774,6 @@ def list_jobs_v1_extract_jobs_get_with_http_info( _param = self._list_jobs_v1_extract_jobs_get_serialize( job_id=job_id, - url=url, status=status, output=output, start_date=start_date, @@ -792,6 +788,7 @@ def list_jobs_v1_extract_jobs_get_with_http_info( _response_types_map: Dict[str, Optional[str]] = { '200': "JobCollectionResponse", + '400': "ErrorResponse", '401': "ErrorResponse", '404': "ErrorResponse", '422': "HTTPValidationError", @@ -810,8 +807,7 @@ def list_jobs_v1_extract_jobs_get_with_http_info( @validate_call def list_jobs_v1_extract_jobs_get_without_preload_content( self, - job_id: Annotated[Optional[StrictStr], Field(description="Filter by job ID")] = None, - url: Annotated[Optional[StrictStr], Field(description="Filter by target URL")] = None, + job_id: Annotated[Optional[StrictStr], Field(description="Filter by full job ID (exact match, UUID)")] = None, status: Annotated[Optional[Any], Field(description="Filter by job status")] = None, output: Annotated[Optional[Any], Field(description="Filter by output format")] = None, start_date: Annotated[Optional[datetime], Field(description="Filter jobs created on or after this date")] = None, @@ -833,12 +829,10 @@ def list_jobs_v1_extract_jobs_get_without_preload_content( ) -> RESTResponseType: """List extraction jobs - List and filter extraction jobs by job ID, URL, status, output format, and date range + List and filter extraction jobs by full job ID (exact match), status, output format, and date range - :param job_id: Filter by job ID + :param job_id: Filter by full job ID (exact match, UUID) :type job_id: str - :param url: Filter by target URL - :type url: str :param status: Filter by job status :type status: JobStatus :param output: Filter by output format @@ -875,7 +869,6 @@ def list_jobs_v1_extract_jobs_get_without_preload_content( _param = self._list_jobs_v1_extract_jobs_get_serialize( job_id=job_id, - url=url, status=status, output=output, start_date=start_date, @@ -890,6 +883,7 @@ def list_jobs_v1_extract_jobs_get_without_preload_content( _response_types_map: Dict[str, Optional[str]] = { '200': "JobCollectionResponse", + '400': "ErrorResponse", '401': "ErrorResponse", '404': "ErrorResponse", '422': "HTTPValidationError", @@ -904,7 +898,6 @@ def list_jobs_v1_extract_jobs_get_without_preload_content( def _list_jobs_v1_extract_jobs_get_serialize( self, job_id, - url, status, output, start_date, @@ -937,10 +930,6 @@ def _list_jobs_v1_extract_jobs_get_serialize( _query_params.append(('job_id', job_id)) - if url is not None: - - _query_params.append(('url', url)) - if status is not None: _query_params.append(('status', status.value)) diff --git a/geonode_scraper_sdk/api/google_api.py b/geonode_scraper_sdk/api/google_api.py new file mode 100644 index 0000000..4317349 --- /dev/null +++ b/geonode_scraper_sdk/api/google_api.py @@ -0,0 +1,632 @@ +""" + Scraper API + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import warnings +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated + +from geonode_scraper_sdk.models.google_search_light_request import GoogleSearchLightRequest +from geonode_scraper_sdk.models.google_search_light_response import GoogleSearchLightResponse +from geonode_scraper_sdk.models.google_shopping_product_request import GoogleShoppingProductRequest +from geonode_scraper_sdk.models.google_shopping_product_response import GoogleShoppingProductResponse + +from geonode_scraper_sdk.api_client import ApiClient, RequestSerialized +from geonode_scraper_sdk.api_response import ApiResponse +from geonode_scraper_sdk.rest import RESTResponseType + + +class GoogleApi: + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + def __init__(self, api_client=None) -> None: + if api_client is None: + api_client = ApiClient.get_default() + self.api_client = api_client + + + @validate_call + def google_search_light_v1_google_search_light_post( + self, + google_search_light_request: GoogleSearchLightRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> GoogleSearchLightResponse: + """Google search, light + + Organic Google results, in one shape for every request: `{job_id, query, pages_requested, pages_returned, pages_stopped, pages: [...]}`. `pages` asks for pages 1 to N in one request, fetched through one Google session and exit IP and billed per page returned; without it the answer holds one page. `format` chooses what each page carries: the parsed results (json), the page as Google sent it (html), or both. `ai_overview` adds Google's AI Overview on page 1. + + :param google_search_light_request: (required) + :type google_search_light_request: GoogleSearchLightRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._google_search_light_v1_google_search_light_post_serialize( + google_search_light_request=google_search_light_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "GoogleSearchLightResponse", + '401': None, + '402': "ErrorResponse", + '408': "ErrorResponse", + '422': "ErrorResponse", + '429': None, + '500': "ErrorResponse", + '502': "ErrorResponse", + '503': "ErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def google_search_light_v1_google_search_light_post_with_http_info( + self, + google_search_light_request: GoogleSearchLightRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[GoogleSearchLightResponse]: + """Google search, light + + Organic Google results, in one shape for every request: `{job_id, query, pages_requested, pages_returned, pages_stopped, pages: [...]}`. `pages` asks for pages 1 to N in one request, fetched through one Google session and exit IP and billed per page returned; without it the answer holds one page. `format` chooses what each page carries: the parsed results (json), the page as Google sent it (html), or both. `ai_overview` adds Google's AI Overview on page 1. + + :param google_search_light_request: (required) + :type google_search_light_request: GoogleSearchLightRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._google_search_light_v1_google_search_light_post_serialize( + google_search_light_request=google_search_light_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "GoogleSearchLightResponse", + '401': None, + '402': "ErrorResponse", + '408': "ErrorResponse", + '422': "ErrorResponse", + '429': None, + '500': "ErrorResponse", + '502': "ErrorResponse", + '503': "ErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def google_search_light_v1_google_search_light_post_without_preload_content( + self, + google_search_light_request: GoogleSearchLightRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Google search, light + + Organic Google results, in one shape for every request: `{job_id, query, pages_requested, pages_returned, pages_stopped, pages: [...]}`. `pages` asks for pages 1 to N in one request, fetched through one Google session and exit IP and billed per page returned; without it the answer holds one page. `format` chooses what each page carries: the parsed results (json), the page as Google sent it (html), or both. `ai_overview` adds Google's AI Overview on page 1. + + :param google_search_light_request: (required) + :type google_search_light_request: GoogleSearchLightRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._google_search_light_v1_google_search_light_post_serialize( + google_search_light_request=google_search_light_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "GoogleSearchLightResponse", + '401': None, + '402': "ErrorResponse", + '408': "ErrorResponse", + '422': "ErrorResponse", + '429': None, + '500': "ErrorResponse", + '502': "ErrorResponse", + '503': "ErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _google_search_light_v1_google_search_light_post_serialize( + self, + google_search_light_request, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if google_search_light_request is not None: + _body_params = google_search_light_request + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'ApiKeyAuth' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v1/google/search/light', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def google_shopping_product_v1_google_shopping_product_post( + self, + google_shopping_product_request: GoogleShoppingProductRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> GoogleShoppingProductResponse: + """Google Shopping, a product and its sellers + + A Google Shopping product by its catalog id, and the stores that sell it with their prices: the stores the product's page shows, and those behind its \"More stores\" button, ten at each of `more_stores` asks. As a US buyer sees it, in English. One request is one product, whatever the number of stores. + + :param google_shopping_product_request: (required) + :type google_shopping_product_request: GoogleShoppingProductRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._google_shopping_product_v1_google_shopping_product_post_serialize( + google_shopping_product_request=google_shopping_product_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "GoogleShoppingProductResponse", + '401': None, + '402': "ErrorResponse", + '408': "ErrorResponse", + '422': "ErrorResponse", + '429': None, + '500': "ErrorResponse", + '502': "ErrorResponse", + '503': "ErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def google_shopping_product_v1_google_shopping_product_post_with_http_info( + self, + google_shopping_product_request: GoogleShoppingProductRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[GoogleShoppingProductResponse]: + """Google Shopping, a product and its sellers + + A Google Shopping product by its catalog id, and the stores that sell it with their prices: the stores the product's page shows, and those behind its \"More stores\" button, ten at each of `more_stores` asks. As a US buyer sees it, in English. One request is one product, whatever the number of stores. + + :param google_shopping_product_request: (required) + :type google_shopping_product_request: GoogleShoppingProductRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._google_shopping_product_v1_google_shopping_product_post_serialize( + google_shopping_product_request=google_shopping_product_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "GoogleShoppingProductResponse", + '401': None, + '402': "ErrorResponse", + '408': "ErrorResponse", + '422': "ErrorResponse", + '429': None, + '500': "ErrorResponse", + '502': "ErrorResponse", + '503': "ErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def google_shopping_product_v1_google_shopping_product_post_without_preload_content( + self, + google_shopping_product_request: GoogleShoppingProductRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Google Shopping, a product and its sellers + + A Google Shopping product by its catalog id, and the stores that sell it with their prices: the stores the product's page shows, and those behind its \"More stores\" button, ten at each of `more_stores` asks. As a US buyer sees it, in English. One request is one product, whatever the number of stores. + + :param google_shopping_product_request: (required) + :type google_shopping_product_request: GoogleShoppingProductRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._google_shopping_product_v1_google_shopping_product_post_serialize( + google_shopping_product_request=google_shopping_product_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "GoogleShoppingProductResponse", + '401': None, + '402': "ErrorResponse", + '408': "ErrorResponse", + '422': "ErrorResponse", + '429': None, + '500': "ErrorResponse", + '502': "ErrorResponse", + '503': "ErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _google_shopping_product_v1_google_shopping_product_post_serialize( + self, + google_shopping_product_request, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if google_shopping_product_request is not None: + _body_params = google_shopping_product_request + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'ApiKeyAuth' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v1/google/shopping/product', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) diff --git a/geonode_scraper_sdk/api/map_api.py b/geonode_scraper_sdk/api/map_api.py index 37a79ed..5fdfdf5 100644 --- a/geonode_scraper_sdk/api/map_api.py +++ b/geonode_scraper_sdk/api/map_api.py @@ -16,7 +16,7 @@ from typing_extensions import Annotated from datetime import datetime -from pydantic import Field, StrictStr +from pydantic import Field from typing import Any, Optional from typing_extensions import Annotated from uuid import UUID @@ -316,7 +316,6 @@ def _get_map_job_v1_map_job_id_get_serialize( @validate_call def list_map_jobs_v1_map_jobs_get( self, - url: Annotated[Optional[StrictStr], Field(description="Filter by base URL (partial match)")] = None, status: Annotated[Optional[Any], Field(description="Filter by job status")] = None, start_date: Annotated[Optional[datetime], Field(description="Filter jobs created on or after this date")] = None, end_date: Annotated[Optional[datetime], Field(description="Filter jobs created on or before this date")] = None, @@ -339,8 +338,6 @@ def list_map_jobs_v1_map_jobs_get( List map jobs for the authenticated user with optional filtering and pagination - :param url: Filter by base URL (partial match) - :type url: str :param status: Filter by job status :type status: JobStatus :param start_date: Filter jobs created on or after this date @@ -374,7 +371,6 @@ def list_map_jobs_v1_map_jobs_get( """ # noqa: E501 _param = self._list_map_jobs_v1_map_jobs_get_serialize( - url=url, status=status, start_date=start_date, end_date=end_date, @@ -388,6 +384,7 @@ def list_map_jobs_v1_map_jobs_get( _response_types_map: Dict[str, Optional[str]] = { '200': "MapJobsResponse", + '400': "ErrorResponse", '401': "ErrorResponse", '422': "HTTPValidationError", } @@ -405,7 +402,6 @@ def list_map_jobs_v1_map_jobs_get( @validate_call def list_map_jobs_v1_map_jobs_get_with_http_info( self, - url: Annotated[Optional[StrictStr], Field(description="Filter by base URL (partial match)")] = None, status: Annotated[Optional[Any], Field(description="Filter by job status")] = None, start_date: Annotated[Optional[datetime], Field(description="Filter jobs created on or after this date")] = None, end_date: Annotated[Optional[datetime], Field(description="Filter jobs created on or before this date")] = None, @@ -428,8 +424,6 @@ def list_map_jobs_v1_map_jobs_get_with_http_info( List map jobs for the authenticated user with optional filtering and pagination - :param url: Filter by base URL (partial match) - :type url: str :param status: Filter by job status :type status: JobStatus :param start_date: Filter jobs created on or after this date @@ -463,7 +457,6 @@ def list_map_jobs_v1_map_jobs_get_with_http_info( """ # noqa: E501 _param = self._list_map_jobs_v1_map_jobs_get_serialize( - url=url, status=status, start_date=start_date, end_date=end_date, @@ -477,6 +470,7 @@ def list_map_jobs_v1_map_jobs_get_with_http_info( _response_types_map: Dict[str, Optional[str]] = { '200': "MapJobsResponse", + '400': "ErrorResponse", '401': "ErrorResponse", '422': "HTTPValidationError", } @@ -494,7 +488,6 @@ def list_map_jobs_v1_map_jobs_get_with_http_info( @validate_call def list_map_jobs_v1_map_jobs_get_without_preload_content( self, - url: Annotated[Optional[StrictStr], Field(description="Filter by base URL (partial match)")] = None, status: Annotated[Optional[Any], Field(description="Filter by job status")] = None, start_date: Annotated[Optional[datetime], Field(description="Filter jobs created on or after this date")] = None, end_date: Annotated[Optional[datetime], Field(description="Filter jobs created on or before this date")] = None, @@ -517,8 +510,6 @@ def list_map_jobs_v1_map_jobs_get_without_preload_content( List map jobs for the authenticated user with optional filtering and pagination - :param url: Filter by base URL (partial match) - :type url: str :param status: Filter by job status :type status: JobStatus :param start_date: Filter jobs created on or after this date @@ -552,7 +543,6 @@ def list_map_jobs_v1_map_jobs_get_without_preload_content( """ # noqa: E501 _param = self._list_map_jobs_v1_map_jobs_get_serialize( - url=url, status=status, start_date=start_date, end_date=end_date, @@ -566,6 +556,7 @@ def list_map_jobs_v1_map_jobs_get_without_preload_content( _response_types_map: Dict[str, Optional[str]] = { '200': "MapJobsResponse", + '400': "ErrorResponse", '401': "ErrorResponse", '422': "HTTPValidationError", } @@ -578,7 +569,6 @@ def list_map_jobs_v1_map_jobs_get_without_preload_content( def _list_map_jobs_v1_map_jobs_get_serialize( self, - url, status, start_date, end_date, @@ -606,10 +596,6 @@ def _list_map_jobs_v1_map_jobs_get_serialize( # process the path parameters # process the query parameters - if url is not None: - - _query_params.append(('url', url)) - if status is not None: _query_params.append(('status', status.value)) @@ -743,6 +729,7 @@ def map_urls_v1_map_post( '400': "ErrorResponse", '401': "ErrorResponse", '402': "ErrorResponse", + '403': "ErrorResponse", '408': "ErrorResponse", '422': "HTTPValidationError", '429': "ErrorResponse", @@ -818,6 +805,7 @@ def map_urls_v1_map_post_with_http_info( '400': "ErrorResponse", '401': "ErrorResponse", '402': "ErrorResponse", + '403': "ErrorResponse", '408': "ErrorResponse", '422': "HTTPValidationError", '429': "ErrorResponse", @@ -893,6 +881,7 @@ def map_urls_v1_map_post_without_preload_content( '400': "ErrorResponse", '401': "ErrorResponse", '402': "ErrorResponse", + '403': "ErrorResponse", '408': "ErrorResponse", '422': "HTTPValidationError", '429': "ErrorResponse", diff --git a/geonode_scraper_sdk/api/search_api.py b/geonode_scraper_sdk/api/search_api.py index 41e1124..30ea47c 100644 --- a/geonode_scraper_sdk/api/search_api.py +++ b/geonode_scraper_sdk/api/search_api.py @@ -16,7 +16,7 @@ from typing_extensions import Annotated from datetime import datetime -from pydantic import Field, StrictStr +from pydantic import Field from typing import Any, Optional from typing_extensions import Annotated from uuid import UUID @@ -316,7 +316,6 @@ def _get_search_job_v1_search_job_id_get_serialize( @validate_call def list_search_jobs_v1_search_jobs_get( self, - query: Annotated[Optional[StrictStr], Field(description="Filter by search query (partial match)")] = None, status: Annotated[Optional[Any], Field(description="Filter by job status")] = None, start_date: Annotated[Optional[datetime], Field(description="Filter jobs created on or after this date")] = None, end_date: Annotated[Optional[datetime], Field(description="Filter jobs created on or before this date")] = None, @@ -339,8 +338,6 @@ def list_search_jobs_v1_search_jobs_get( List search jobs for the authenticated user with optional filtering and pagination - :param query: Filter by search query (partial match) - :type query: str :param status: Filter by job status :type status: JobStatus :param start_date: Filter jobs created on or after this date @@ -374,7 +371,6 @@ def list_search_jobs_v1_search_jobs_get( """ # noqa: E501 _param = self._list_search_jobs_v1_search_jobs_get_serialize( - query=query, status=status, start_date=start_date, end_date=end_date, @@ -388,6 +384,7 @@ def list_search_jobs_v1_search_jobs_get( _response_types_map: Dict[str, Optional[str]] = { '200': "SearchJobsResponse", + '400': "ErrorResponse", '401': "ErrorResponse", '422': "HTTPValidationError", } @@ -405,7 +402,6 @@ def list_search_jobs_v1_search_jobs_get( @validate_call def list_search_jobs_v1_search_jobs_get_with_http_info( self, - query: Annotated[Optional[StrictStr], Field(description="Filter by search query (partial match)")] = None, status: Annotated[Optional[Any], Field(description="Filter by job status")] = None, start_date: Annotated[Optional[datetime], Field(description="Filter jobs created on or after this date")] = None, end_date: Annotated[Optional[datetime], Field(description="Filter jobs created on or before this date")] = None, @@ -428,8 +424,6 @@ def list_search_jobs_v1_search_jobs_get_with_http_info( List search jobs for the authenticated user with optional filtering and pagination - :param query: Filter by search query (partial match) - :type query: str :param status: Filter by job status :type status: JobStatus :param start_date: Filter jobs created on or after this date @@ -463,7 +457,6 @@ def list_search_jobs_v1_search_jobs_get_with_http_info( """ # noqa: E501 _param = self._list_search_jobs_v1_search_jobs_get_serialize( - query=query, status=status, start_date=start_date, end_date=end_date, @@ -477,6 +470,7 @@ def list_search_jobs_v1_search_jobs_get_with_http_info( _response_types_map: Dict[str, Optional[str]] = { '200': "SearchJobsResponse", + '400': "ErrorResponse", '401': "ErrorResponse", '422': "HTTPValidationError", } @@ -494,7 +488,6 @@ def list_search_jobs_v1_search_jobs_get_with_http_info( @validate_call def list_search_jobs_v1_search_jobs_get_without_preload_content( self, - query: Annotated[Optional[StrictStr], Field(description="Filter by search query (partial match)")] = None, status: Annotated[Optional[Any], Field(description="Filter by job status")] = None, start_date: Annotated[Optional[datetime], Field(description="Filter jobs created on or after this date")] = None, end_date: Annotated[Optional[datetime], Field(description="Filter jobs created on or before this date")] = None, @@ -517,8 +510,6 @@ def list_search_jobs_v1_search_jobs_get_without_preload_content( List search jobs for the authenticated user with optional filtering and pagination - :param query: Filter by search query (partial match) - :type query: str :param status: Filter by job status :type status: JobStatus :param start_date: Filter jobs created on or after this date @@ -552,7 +543,6 @@ def list_search_jobs_v1_search_jobs_get_without_preload_content( """ # noqa: E501 _param = self._list_search_jobs_v1_search_jobs_get_serialize( - query=query, status=status, start_date=start_date, end_date=end_date, @@ -566,6 +556,7 @@ def list_search_jobs_v1_search_jobs_get_without_preload_content( _response_types_map: Dict[str, Optional[str]] = { '200': "SearchJobsResponse", + '400': "ErrorResponse", '401': "ErrorResponse", '422': "HTTPValidationError", } @@ -578,7 +569,6 @@ def list_search_jobs_v1_search_jobs_get_without_preload_content( def _list_search_jobs_v1_search_jobs_get_serialize( self, - query, status, start_date, end_date, @@ -606,10 +596,6 @@ def _list_search_jobs_v1_search_jobs_get_serialize( # process the path parameters # process the query parameters - if query is not None: - - _query_params.append(('query', query)) - if status is not None: _query_params.append(('status', status.value)) @@ -741,6 +727,7 @@ def search_v1_search_post( '200': "SearchResponse", '401': None, '402': "ErrorResponse", + '403': "ErrorResponse", '408': "ErrorResponse", '422': "ErrorResponse", '429': None, @@ -815,6 +802,7 @@ def search_v1_search_post_with_http_info( '200': "SearchResponse", '401': None, '402': "ErrorResponse", + '403': "ErrorResponse", '408': "ErrorResponse", '422': "ErrorResponse", '429': None, @@ -889,6 +877,7 @@ def search_v1_search_post_without_preload_content( '200': "SearchResponse", '401': None, '402': "ErrorResponse", + '403': "ErrorResponse", '408': "ErrorResponse", '422': "ErrorResponse", '429': None, diff --git a/geonode_scraper_sdk/api/statistics_api.py b/geonode_scraper_sdk/api/statistics_api.py index c86c15b..4edfc3b 100644 --- a/geonode_scraper_sdk/api/statistics_api.py +++ b/geonode_scraper_sdk/api/statistics_api.py @@ -42,8 +42,8 @@ def __init__(self, api_client=None) -> None: @validate_call def get_statistics_v1_statistics_get( self, - start_date: Annotated[Optional[datetime], Field(description="Filter by start date (defaults to 30 days ago)")] = None, - end_date: Annotated[Optional[datetime], Field(description="Filter by end date (defaults to now)")] = None, + start_date: Annotated[Optional[datetime], Field(description="Filter by start date (defaults to 30 days ago). The window covers at most 366 days, counted back from the end of `end_date` (a date-only `end_date` includes its whole day); an older start is moved up")] = None, + end_date: Annotated[Optional[datetime], Field(description="Filter by end date (defaults to now); a later end date is moved back to now")] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -61,9 +61,9 @@ def get_statistics_v1_statistics_get( Retrieve aggregated extraction statistics for a given date range - :param start_date: Filter by start date (defaults to 30 days ago) + :param start_date: Filter by start date (defaults to 30 days ago). The window covers at most 366 days, counted back from the end of `end_date` (a date-only `end_date` includes its whole day); an older start is moved up :type start_date: datetime - :param end_date: Filter by end date (defaults to now) + :param end_date: Filter by end date (defaults to now); a later end date is moved back to now :type end_date: datetime :param _request_timeout: timeout setting for this request. If one number provided, it will be total request @@ -115,8 +115,8 @@ def get_statistics_v1_statistics_get( @validate_call def get_statistics_v1_statistics_get_with_http_info( self, - start_date: Annotated[Optional[datetime], Field(description="Filter by start date (defaults to 30 days ago)")] = None, - end_date: Annotated[Optional[datetime], Field(description="Filter by end date (defaults to now)")] = None, + start_date: Annotated[Optional[datetime], Field(description="Filter by start date (defaults to 30 days ago). The window covers at most 366 days, counted back from the end of `end_date` (a date-only `end_date` includes its whole day); an older start is moved up")] = None, + end_date: Annotated[Optional[datetime], Field(description="Filter by end date (defaults to now); a later end date is moved back to now")] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -134,9 +134,9 @@ def get_statistics_v1_statistics_get_with_http_info( Retrieve aggregated extraction statistics for a given date range - :param start_date: Filter by start date (defaults to 30 days ago) + :param start_date: Filter by start date (defaults to 30 days ago). The window covers at most 366 days, counted back from the end of `end_date` (a date-only `end_date` includes its whole day); an older start is moved up :type start_date: datetime - :param end_date: Filter by end date (defaults to now) + :param end_date: Filter by end date (defaults to now); a later end date is moved back to now :type end_date: datetime :param _request_timeout: timeout setting for this request. If one number provided, it will be total request @@ -188,8 +188,8 @@ def get_statistics_v1_statistics_get_with_http_info( @validate_call def get_statistics_v1_statistics_get_without_preload_content( self, - start_date: Annotated[Optional[datetime], Field(description="Filter by start date (defaults to 30 days ago)")] = None, - end_date: Annotated[Optional[datetime], Field(description="Filter by end date (defaults to now)")] = None, + start_date: Annotated[Optional[datetime], Field(description="Filter by start date (defaults to 30 days ago). The window covers at most 366 days, counted back from the end of `end_date` (a date-only `end_date` includes its whole day); an older start is moved up")] = None, + end_date: Annotated[Optional[datetime], Field(description="Filter by end date (defaults to now); a later end date is moved back to now")] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -207,9 +207,9 @@ def get_statistics_v1_statistics_get_without_preload_content( Retrieve aggregated extraction statistics for a given date range - :param start_date: Filter by start date (defaults to 30 days ago) + :param start_date: Filter by start date (defaults to 30 days ago). The window covers at most 366 days, counted back from the end of `end_date` (a date-only `end_date` includes its whole day); an older start is moved up :type start_date: datetime - :param end_date: Filter by end date (defaults to now) + :param end_date: Filter by end date (defaults to now); a later end date is moved back to now :type end_date: datetime :param _request_timeout: timeout setting for this request. If one number provided, it will be total request diff --git a/geonode_scraper_sdk/models/__init__.py b/geonode_scraper_sdk/models/__init__.py index 2c66652..2a9a317 100644 --- a/geonode_scraper_sdk/models/__init__.py +++ b/geonode_scraper_sdk/models/__init__.py @@ -13,9 +13,12 @@ """ # noqa: E501 # import models into model package +from geonode_scraper_sdk.models.ai_overview_model import AiOverviewModel +from geonode_scraper_sdk.models.ai_source_model import AiSourceModel from geonode_scraper_sdk.models.batch_accepted import BatchAccepted from geonode_scraper_sdk.models.batch_cancelled import BatchCancelled from geonode_scraper_sdk.models.batch_config import BatchConfig +from geonode_scraper_sdk.models.batch_download_response import BatchDownloadResponse from geonode_scraper_sdk.models.batch_item_metadata import BatchItemMetadata from geonode_scraper_sdk.models.batch_jobs_response import BatchJobsResponse from geonode_scraper_sdk.models.batch_list_item_response import BatchListItemResponse @@ -46,6 +49,11 @@ from geonode_scraper_sdk.models.extraction_error_code import ExtractionErrorCode from geonode_scraper_sdk.models.extraction_error_response import ExtractionErrorResponse from geonode_scraper_sdk.models.extraction_metadata import ExtractionMetadata +from geonode_scraper_sdk.models.google_search_light_page import GoogleSearchLightPage +from geonode_scraper_sdk.models.google_search_light_request import GoogleSearchLightRequest +from geonode_scraper_sdk.models.google_search_light_response import GoogleSearchLightResponse +from geonode_scraper_sdk.models.google_shopping_product_request import GoogleShoppingProductRequest +from geonode_scraper_sdk.models.google_shopping_product_response import GoogleShoppingProductResponse from geonode_scraper_sdk.models.http_validation_error import HTTPValidationError from geonode_scraper_sdk.models.health_response import HealthResponse from geonode_scraper_sdk.models.health_status import HealthStatus @@ -73,6 +81,10 @@ from geonode_scraper_sdk.models.search_list_item_response import SearchListItemResponse from geonode_scraper_sdk.models.search_request import SearchRequest from geonode_scraper_sdk.models.search_response import SearchResponse +from geonode_scraper_sdk.models.shopping_installment_model import ShoppingInstallmentModel +from geonode_scraper_sdk.models.shopping_product_model import ShoppingProductModel +from geonode_scraper_sdk.models.shopping_promotion_model import ShoppingPromotionModel +from geonode_scraper_sdk.models.shopping_seller_model import ShoppingSellerModel from geonode_scraper_sdk.models.statistics_response import StatisticsResponse from geonode_scraper_sdk.models.tokens_usage_response import TokensUsageResponse from geonode_scraper_sdk.models.validation_error import ValidationError diff --git a/geonode_scraper_sdk/models/ai_overview_model.py b/geonode_scraper_sdk/models/ai_overview_model.py new file mode 100644 index 0000000..f330fcd --- /dev/null +++ b/geonode_scraper_sdk/models/ai_overview_model.py @@ -0,0 +1,105 @@ +# coding: utf-8 + +""" + Scraper API + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from geonode_scraper_sdk.models.ai_source_model import AiSourceModel +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class AiOverviewModel(BaseModel): + """ + AiOverviewModel + """ # noqa: E501 + sources: Optional[List[AiSourceModel]] = Field(default=None, description="The sources Google cites for it") + text: StrictStr = Field(description="The overview's text: a paragraph or heading per line, list items starting with •") + via: StrictStr = Field(description="\"page\": it came in the results page; \"async\": Google loads it after the page, and it was asked for") + __properties: ClassVar[List[str]] = ["sources", "text", "via"] + + @field_validator('via') + def via_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['page', 'async']): + raise ValueError("must be one of enum values ('page', 'async')") + return value + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of AiOverviewModel from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in sources (list) + _items = [] + if self.sources: + for _item_sources in self.sources: + if _item_sources: + _items.append(_item_sources.to_dict()) + _dict['sources'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of AiOverviewModel from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "sources": [AiSourceModel.from_dict(_item) for _item in obj["sources"]] if obj.get("sources") is not None else None, + "text": obj.get("text"), + "via": obj.get("via") + }) + return _obj diff --git a/geonode_scraper_sdk/models/ai_source_model.py b/geonode_scraper_sdk/models/ai_source_model.py new file mode 100644 index 0000000..d3a014b --- /dev/null +++ b/geonode_scraper_sdk/models/ai_source_model.py @@ -0,0 +1,88 @@ +# coding: utf-8 + +""" + Scraper API + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class AiSourceModel(BaseModel): + """ + AiSourceModel + """ # noqa: E501 + title: StrictStr = Field(description="The source page's title, as Google's source card shows it") + url: StrictStr = Field(description="Google's redirect link to the source (https://www.google.com/goto?url=…), not the source's own URL") + __properties: ClassVar[List[str]] = ["title", "url"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of AiSourceModel from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of AiSourceModel from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "title": obj.get("title"), + "url": obj.get("url") + }) + return _obj diff --git a/geonode_scraper_sdk/models/batch_download_response.py b/geonode_scraper_sdk/models/batch_download_response.py new file mode 100644 index 0000000..cc35270 --- /dev/null +++ b/geonode_scraper_sdk/models/batch_download_response.py @@ -0,0 +1,92 @@ +# coding: utf-8 + +""" + Scraper API + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from datetime import datetime +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List +from uuid import UUID +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class BatchDownloadResponse(BaseModel): + """ + BatchDownloadResponse + """ # noqa: E501 + download_url: StrictStr = Field(description="Temporary link to a zip with one file per successful URL in the batch's formats and a manifest.json of the URLs without a file") + expires_at: datetime = Field(description="When the link stops working; ask again for a new one") + job_id: UUID = Field(description="Unique job identifier") + __properties: ClassVar[List[str]] = ["download_url", "expires_at", "job_id"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of BatchDownloadResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of BatchDownloadResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "download_url": obj.get("download_url"), + "expires_at": obj.get("expires_at"), + "job_id": obj.get("job_id") + }) + return _obj diff --git a/geonode_scraper_sdk/models/extraction_error_code.py b/geonode_scraper_sdk/models/extraction_error_code.py index 63a1ef7..b743d66 100644 --- a/geonode_scraper_sdk/models/extraction_error_code.py +++ b/geonode_scraper_sdk/models/extraction_error_code.py @@ -43,6 +43,8 @@ class ExtractionErrorCode(str, Enum): PAYMENT_REQUIRED = 'PAYMENT_REQUIRED' INTERNAL_ERROR = 'INTERNAL_ERROR' PROXY_ERROR = 'PROXY_ERROR' + TARGET_BLOCKED = 'TARGET_BLOCKED' + GOOGLE_SEARCH_MOVED = 'GOOGLE_SEARCH_MOVED' @classmethod def from_json(cls, json_str: str) -> Self: diff --git a/geonode_scraper_sdk/models/google_search_light_page.py b/geonode_scraper_sdk/models/google_search_light_page.py new file mode 100644 index 0000000..fe66322 --- /dev/null +++ b/geonode_scraper_sdk/models/google_search_light_page.py @@ -0,0 +1,135 @@ +# coding: utf-8 + +""" + Scraper API + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from geonode_scraper_sdk.models.ai_overview_model import AiOverviewModel +from geonode_scraper_sdk.models.search_hit_model import SearchHitModel +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class GoogleSearchLightPage(BaseModel): + """ + One result page. It carries what the request's `format` names: \"json\" the parsed results, \"html\" the page itself, \"both\" all of it. + """ # noqa: E501 + ai_overview: Optional[AiOverviewModel] = None + attempts: StrictInt = Field(description="Number of upstream attempts made for this page") + html: Optional[StrictStr] = None + page: StrictInt = Field(description="Result page") + results: Optional[List[SearchHitModel]] = None + spelling_correction: Optional[StrictStr] = None + suggestions: Optional[List[StrictStr]] = None + __properties: ClassVar[List[str]] = ["ai_overview", "attempts", "html", "page", "results", "spelling_correction", "suggestions"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of GoogleSearchLightPage from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of ai_overview + if self.ai_overview: + _dict['ai_overview'] = self.ai_overview.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in results (list) + _items = [] + if self.results: + for _item_results in self.results: + if _item_results: + _items.append(_item_results.to_dict()) + _dict['results'] = _items + # set to None if ai_overview (nullable) is None + # and model_fields_set contains the field + if self.ai_overview is None and "ai_overview" in self.model_fields_set: + _dict['ai_overview'] = None + + # set to None if html (nullable) is None + # and model_fields_set contains the field + if self.html is None and "html" in self.model_fields_set: + _dict['html'] = None + + # set to None if results (nullable) is None + # and model_fields_set contains the field + if self.results is None and "results" in self.model_fields_set: + _dict['results'] = None + + # set to None if spelling_correction (nullable) is None + # and model_fields_set contains the field + if self.spelling_correction is None and "spelling_correction" in self.model_fields_set: + _dict['spelling_correction'] = None + + # set to None if suggestions (nullable) is None + # and model_fields_set contains the field + if self.suggestions is None and "suggestions" in self.model_fields_set: + _dict['suggestions'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of GoogleSearchLightPage from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "ai_overview": AiOverviewModel.from_dict(obj["ai_overview"]) if obj.get("ai_overview") is not None else None, + "attempts": obj.get("attempts"), + "html": obj.get("html"), + "page": obj.get("page"), + "results": [SearchHitModel.from_dict(_item) for _item in obj["results"]] if obj.get("results") is not None else None, + "spelling_correction": obj.get("spelling_correction"), + "suggestions": obj.get("suggestions") + }) + return _obj diff --git a/geonode_scraper_sdk/models/google_search_light_request.py b/geonode_scraper_sdk/models/google_search_light_request.py new file mode 100644 index 0000000..a7c0626 --- /dev/null +++ b/geonode_scraper_sdk/models/google_search_light_request.py @@ -0,0 +1,167 @@ +# coding: utf-8 + +""" + Scraper API + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class GoogleSearchLightRequest(BaseModel): + """ + GoogleSearchLightRequest + """ # noqa: E501 + ai_overview: Optional[StrictBool] = Field(default=False, description="Also return Google's AI Overview for the query, when Google gives one: as text and its sources (`ai_overview` in the response) with format \"json\" or \"both\", and written into the page, where Google's own JS would write it, with format \"html\" or \"both\" (its container marked `data-aio-written`). Page 1 only. Where Google loads it after the page, it is asked for too, which can add a few seconds; a search whose overview cannot be had still returns its results.") + device: Optional[StrictStr] = Field(default='desktop', description="Whose results page to fetch: \"desktop\"; \"mobile\", Google's results as an Android phone gets them; \"iphone\" and \"ipad\", as Safari on an iPhone or an iPad gets them. Pages 2 and on follow the same device's page 1.") + format: Optional[StrictStr] = Field(default='json', description="What each page of the answer carries: \"json\" the parsed results, \"html\" the page as Google sent it (Google's ordinary results page), \"both\" all of it. The answer is JSON whatever the format. With `Accept-Encoding: gzip`, \"html\" and \"both\" come gzip-compressed (`Content-Encoding: gzip`).") + locale: Optional[StrictStr] = None + page: Optional[Annotated[int, Field(le=20, strict=True, ge=1)]] = Field(default=1, description="Result page to fetch, 1 to 20. Every page is its own search and is billed as one. Ask for a query's pages in order: the next page is served from the same Google session as the last one.") + pages: Optional[Annotated[int, Field(le=10, strict=True, ge=1)]] = Field(default=1, description="Pages 1 to `pages` (at most 10) in one request, fetched one after another through one Google session and exit IP, each by the previous page's own next-page link, and returned together in `pages`. Billed per page returned: the request stops at the first page that fails or that Google does not have, and answers with the pages before it. From page 1; not with `url`.") + query: Optional[Annotated[str, Field(strict=True, max_length=1000)]] = Field(default='', description="Search query. Required unless `url` is given, which carries the query itself (`q`).") + safe: Optional[StrictStr] = Field(default='off', description="Safe-search filtering level. Accepted values: \"off\", \"moderate\", or \"strict\".") + time_range: Optional[StrictStr] = None + url: Optional[Annotated[str, Field(strict=True, max_length=2048)]] = None + uule: Optional[Annotated[str, Field(strict=True, max_length=512)]] = None + __properties: ClassVar[List[str]] = ["ai_overview", "device", "format", "locale", "page", "pages", "query", "safe", "time_range", "url", "uule"] + + @field_validator('device') + def device_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['desktop', 'mobile', 'iphone', 'ipad']): + raise ValueError("must be one of enum values ('desktop', 'mobile', 'iphone', 'ipad')") + return value + + @field_validator('format') + def format_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['json', 'html', 'both']): + raise ValueError("must be one of enum values ('json', 'html', 'both')") + return value + + @field_validator('safe') + def safe_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['off', 'moderate', 'strict']): + raise ValueError("must be one of enum values ('off', 'moderate', 'strict')") + return value + + @field_validator('time_range') + def time_range_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['day', 'week', 'month', 'year']): + raise ValueError("must be one of enum values ('day', 'week', 'month', 'year')") + return value + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of GoogleSearchLightRequest from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # set to None if locale (nullable) is None + # and model_fields_set contains the field + if self.locale is None and "locale" in self.model_fields_set: + _dict['locale'] = None + + # set to None if time_range (nullable) is None + # and model_fields_set contains the field + if self.time_range is None and "time_range" in self.model_fields_set: + _dict['time_range'] = None + + # set to None if url (nullable) is None + # and model_fields_set contains the field + if self.url is None and "url" in self.model_fields_set: + _dict['url'] = None + + # set to None if uule (nullable) is None + # and model_fields_set contains the field + if self.uule is None and "uule" in self.model_fields_set: + _dict['uule'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of GoogleSearchLightRequest from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "ai_overview": obj.get("ai_overview") if obj.get("ai_overview") is not None else False, + "device": obj.get("device") if obj.get("device") is not None else 'desktop', + "format": obj.get("format") if obj.get("format") is not None else 'json', + "locale": obj.get("locale"), + "page": obj.get("page") if obj.get("page") is not None else 1, + "pages": obj.get("pages") if obj.get("pages") is not None else 1, + "query": obj.get("query") if obj.get("query") is not None else '', + "safe": obj.get("safe") if obj.get("safe") is not None else 'off', + "time_range": obj.get("time_range"), + "url": obj.get("url"), + "uule": obj.get("uule") + }) + return _obj diff --git a/geonode_scraper_sdk/models/google_search_light_response.py b/geonode_scraper_sdk/models/google_search_light_response.py new file mode 100644 index 0000000..04ee1fb --- /dev/null +++ b/geonode_scraper_sdk/models/google_search_light_response.py @@ -0,0 +1,110 @@ +# coding: utf-8 + +""" + Scraper API + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from uuid import UUID +from geonode_scraper_sdk.models.google_search_light_page import GoogleSearchLightPage +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class GoogleSearchLightResponse(BaseModel): + """ + One shape for every request, of one page or several (`pages`). + """ # noqa: E501 + job_id: UUID = Field(description="Unique job identifier for this request") + pages: List[GoogleSearchLightPage] = Field(description="The pages, page 1 first") + pages_requested: StrictInt = Field(description="Pages asked for (`pages`; 1 without it)") + pages_returned: StrictInt = Field(description="Pages returned, and billed") + pages_stopped: Optional[StrictStr] = None + query: StrictStr = Field(description="Search query that was submitted") + __properties: ClassVar[List[str]] = ["job_id", "pages", "pages_requested", "pages_returned", "pages_stopped", "query"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of GoogleSearchLightResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in pages (list) + _items = [] + if self.pages: + for _item_pages in self.pages: + if _item_pages: + _items.append(_item_pages.to_dict()) + _dict['pages'] = _items + # set to None if pages_stopped (nullable) is None + # and model_fields_set contains the field + if self.pages_stopped is None and "pages_stopped" in self.model_fields_set: + _dict['pages_stopped'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of GoogleSearchLightResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "job_id": obj.get("job_id"), + "pages": [GoogleSearchLightPage.from_dict(_item) for _item in obj["pages"]] if obj.get("pages") is not None else None, + "pages_requested": obj.get("pages_requested"), + "pages_returned": obj.get("pages_returned"), + "pages_stopped": obj.get("pages_stopped"), + "query": obj.get("query") + }) + return _obj diff --git a/geonode_scraper_sdk/models/google_shopping_product_request.py b/geonode_scraper_sdk/models/google_shopping_product_request.py new file mode 100644 index 0000000..9f01d1f --- /dev/null +++ b/geonode_scraper_sdk/models/google_shopping_product_request.py @@ -0,0 +1,111 @@ +# coding: utf-8 + +""" + Scraper API + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class GoogleShoppingProductRequest(BaseModel): + """ + GoogleShoppingProductRequest + """ # noqa: E501 + catalog_id: Optional[Annotated[str, Field(strict=True)]] = None + more_stores: Optional[Annotated[int, Field(le=15, strict=True, ge=0)]] = Field(default=3, description="How many times to ask for \"More stores\" at most. The product's page shows its first stores (three when there are more); each ask adds up to ten. 0 returns the page's stores only. Asking stops by itself at the end of the list. The price of a request does not depend on it.") + url: Optional[Annotated[str, Field(strict=True, max_length=2048)]] = None + __properties: ClassVar[List[str]] = ["catalog_id", "more_stores", "url"] + + @field_validator('catalog_id') + def catalog_id_validate_regular_expression(cls, value): + """Validates the regular expression""" + if value is None: + return value + + if not re.match(r"^\d{5,25}$", value): + raise ValueError(r"must validate the regular expression /^\d{5,25}$/") + return value + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of GoogleShoppingProductRequest from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # set to None if catalog_id (nullable) is None + # and model_fields_set contains the field + if self.catalog_id is None and "catalog_id" in self.model_fields_set: + _dict['catalog_id'] = None + + # set to None if url (nullable) is None + # and model_fields_set contains the field + if self.url is None and "url" in self.model_fields_set: + _dict['url'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of GoogleShoppingProductRequest from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "catalog_id": obj.get("catalog_id"), + "more_stores": obj.get("more_stores") if obj.get("more_stores") is not None else 3, + "url": obj.get("url") + }) + return _obj diff --git a/geonode_scraper_sdk/models/google_shopping_product_response.py b/geonode_scraper_sdk/models/google_shopping_product_response.py new file mode 100644 index 0000000..5a4c138 --- /dev/null +++ b/geonode_scraper_sdk/models/google_shopping_product_response.py @@ -0,0 +1,125 @@ +# coding: utf-8 + +""" + Scraper API + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from uuid import UUID +from geonode_scraper_sdk.models.shopping_product_model import ShoppingProductModel +from geonode_scraper_sdk.models.shopping_seller_model import ShoppingSellerModel +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class GoogleShoppingProductResponse(BaseModel): + """ + GoogleShoppingProductResponse + """ # noqa: E501 + attempts: StrictInt = Field(description="How many Google sessions the product was asked through") + catalog_id: StrictStr = Field(description="The catalog id that was asked for") + complete: Optional[StrictBool] = None + job_id: UUID + more_stores_pages: StrictInt = Field(description="How many times \"More stores\" was asked for and answered") + product: ShoppingProductModel + sellers: List[ShoppingSellerModel] = Field(description="The product's stores, in Google's order") + sellers_count: StrictInt = Field(description="How many stores are in `sellers`") + sellers_total: Optional[StrictInt] = None + __properties: ClassVar[List[str]] = ["attempts", "catalog_id", "complete", "job_id", "more_stores_pages", "product", "sellers", "sellers_count", "sellers_total"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of GoogleShoppingProductResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of product + if self.product: + _dict['product'] = self.product.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in sellers (list) + _items = [] + if self.sellers: + for _item_sellers in self.sellers: + if _item_sellers: + _items.append(_item_sellers.to_dict()) + _dict['sellers'] = _items + # set to None if complete (nullable) is None + # and model_fields_set contains the field + if self.complete is None and "complete" in self.model_fields_set: + _dict['complete'] = None + + # set to None if sellers_total (nullable) is None + # and model_fields_set contains the field + if self.sellers_total is None and "sellers_total" in self.model_fields_set: + _dict['sellers_total'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of GoogleShoppingProductResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "attempts": obj.get("attempts"), + "catalog_id": obj.get("catalog_id"), + "complete": obj.get("complete"), + "job_id": obj.get("job_id"), + "more_stores_pages": obj.get("more_stores_pages"), + "product": ShoppingProductModel.from_dict(obj["product"]) if obj.get("product") is not None else None, + "sellers": [ShoppingSellerModel.from_dict(_item) for _item in obj["sellers"]] if obj.get("sellers") is not None else None, + "sellers_count": obj.get("sellers_count"), + "sellers_total": obj.get("sellers_total") + }) + return _obj diff --git a/geonode_scraper_sdk/models/search_request.py b/geonode_scraper_sdk/models/search_request.py index 215c116..1700909 100644 --- a/geonode_scraper_sdk/models/search_request.py +++ b/geonode_scraper_sdk/models/search_request.py @@ -30,7 +30,7 @@ class SearchRequest(BaseModel): """ # noqa: E501 engine: Optional[StrictStr] = None locale: Optional[StrictStr] = None - page: Optional[Annotated[int, Field(le=9, strict=True, ge=1)]] = Field(default=1, description="Result page to fetch. Without `engine`, 1 to 9. With `engine` set, the pinned engine's own limit applies instead: brave 9, duckduckgo 5, naver 9.") + page: Optional[Annotated[int, Field(le=9, strict=True, ge=1)]] = Field(default=1, description="Result page to fetch. Without `engine`, 1 to 9. With `engine` set, the pinned engine's own limit applies instead: duckduckgo 5, naver 9, yahoo 9.") query: Annotated[str, Field(min_length=1, strict=True, max_length=1000)] = Field(description="Search query") safe: Optional[StrictStr] = Field(default='off', description="Safe-search filtering level. Accepted values: \"off\", \"moderate\", or \"strict\".") time_range: Optional[StrictStr] = None @@ -42,8 +42,8 @@ def engine_validate_enum(cls, value): if value is None: return value - if value not in set(['brave', 'duckduckgo', 'naver']): - raise ValueError("must be one of enum values ('brave', 'duckduckgo', 'naver')") + if value not in set(['duckduckgo', 'yahoo', 'naver']): + raise ValueError("must be one of enum values ('duckduckgo', 'yahoo', 'naver')") return value @field_validator('safe') diff --git a/geonode_scraper_sdk/models/shopping_installment_model.py b/geonode_scraper_sdk/models/shopping_installment_model.py new file mode 100644 index 0000000..ded2419 --- /dev/null +++ b/geonode_scraper_sdk/models/shopping_installment_model.py @@ -0,0 +1,95 @@ +# coding: utf-8 + +""" + Scraper API + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictFloat, StrictInt +from typing import Any, ClassVar, Dict, List, Optional, Union +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class ShoppingInstallmentModel(BaseModel): + """ + ShoppingInstallmentModel + """ # noqa: E501 + down_payment: Optional[Union[StrictFloat, StrictInt]] = None + monthly_price: Union[StrictFloat, StrictInt] = Field(description="What is paid each month") + months: StrictInt = Field(description="For how many months") + __properties: ClassVar[List[str]] = ["down_payment", "monthly_price", "months"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ShoppingInstallmentModel from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # set to None if down_payment (nullable) is None + # and model_fields_set contains the field + if self.down_payment is None and "down_payment" in self.model_fields_set: + _dict['down_payment'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ShoppingInstallmentModel from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "down_payment": obj.get("down_payment"), + "monthly_price": obj.get("monthly_price"), + "months": obj.get("months") + }) + return _obj diff --git a/geonode_scraper_sdk/models/shopping_product_model.py b/geonode_scraper_sdk/models/shopping_product_model.py new file mode 100644 index 0000000..ba40395 --- /dev/null +++ b/geonode_scraper_sdk/models/shopping_product_model.py @@ -0,0 +1,102 @@ +# coding: utf-8 + +""" + Scraper API + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class ShoppingProductModel(BaseModel): + """ + ShoppingProductModel + """ # noqa: E501 + brand: Optional[StrictStr] = None + catalog_id: StrictStr = Field(description="Google's catalog id of the product") + images: Optional[List[StrictStr]] = Field(default=None, description="The product's pictures, as Google hosts them") + title: Optional[StrictStr] = None + __properties: ClassVar[List[str]] = ["brand", "catalog_id", "images", "title"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ShoppingProductModel from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # set to None if brand (nullable) is None + # and model_fields_set contains the field + if self.brand is None and "brand" in self.model_fields_set: + _dict['brand'] = None + + # set to None if title (nullable) is None + # and model_fields_set contains the field + if self.title is None and "title" in self.model_fields_set: + _dict['title'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ShoppingProductModel from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "brand": obj.get("brand"), + "catalog_id": obj.get("catalog_id"), + "images": obj.get("images"), + "title": obj.get("title") + }) + return _obj diff --git a/geonode_scraper_sdk/models/shopping_promotion_model.py b/geonode_scraper_sdk/models/shopping_promotion_model.py new file mode 100644 index 0000000..1e47903 --- /dev/null +++ b/geonode_scraper_sdk/models/shopping_promotion_model.py @@ -0,0 +1,100 @@ +# coding: utf-8 + +""" + Scraper API + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class ShoppingPromotionModel(BaseModel): + """ + ShoppingPromotionModel + """ # noqa: E501 + code: Optional[StrictStr] = None + expires: Optional[StrictStr] = None + title: StrictStr = Field(description="What the store offers on top of its price: \"10% off Fall Seasonal Categories\"") + __properties: ClassVar[List[str]] = ["code", "expires", "title"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ShoppingPromotionModel from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # set to None if code (nullable) is None + # and model_fields_set contains the field + if self.code is None and "code" in self.model_fields_set: + _dict['code'] = None + + # set to None if expires (nullable) is None + # and model_fields_set contains the field + if self.expires is None and "expires" in self.model_fields_set: + _dict['expires'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ShoppingPromotionModel from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "code": obj.get("code"), + "expires": obj.get("expires"), + "title": obj.get("title") + }) + return _obj diff --git a/geonode_scraper_sdk/models/shopping_seller_model.py b/geonode_scraper_sdk/models/shopping_seller_model.py new file mode 100644 index 0000000..1aef265 --- /dev/null +++ b/geonode_scraper_sdk/models/shopping_seller_model.py @@ -0,0 +1,247 @@ +# coding: utf-8 + +""" + Scraper API + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictFloat, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional, Union +from geonode_scraper_sdk.models.shopping_installment_model import ShoppingInstallmentModel +from geonode_scraper_sdk.models.shopping_promotion_model import ShoppingPromotionModel +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class ShoppingSellerModel(BaseModel): + """ + ShoppingSellerModel + """ # noqa: E501 + condition: Optional[StrictStr] = None + currency: Optional[StrictStr] = None + delivery: Optional[StrictStr] = None + delivery_price: Optional[Union[StrictFloat, StrictInt]] = None + details: Optional[List[StrictStr]] = Field(default=None, description="Whatever else the store's row says") + discount: Optional[StrictStr] = None + domain: Optional[StrictStr] = None + in_stock: Optional[StrictBool] = None + installment: Optional[ShoppingInstallmentModel] = None + link: Optional[StrictStr] = None + more_stores_page: Optional[StrictInt] = None + name: Optional[StrictStr] = None + original_price: Optional[Union[StrictFloat, StrictInt]] = None + payment_methods: Optional[List[StrictStr]] = Field(default=None, description="\"PayPal\", \"Google Pay\", \"Affirm\"") + position: StrictInt = Field(description="1-based place in Google's list of the product's stores") + price: Optional[Union[StrictFloat, StrictInt]] = None + promotion: Optional[ShoppingPromotionModel] = None + returns: Optional[StrictStr] = None + shown: StrictStr = Field(description="\"page\": the product's page shows it at once; \"more_stores\": it is behind the button") + store_rating: Optional[Union[StrictFloat, StrictInt]] = None + store_reviews: Optional[StrictInt] = None + tag: Optional[StrictStr] = None + title: Optional[StrictStr] = None + total_price: Optional[Union[StrictFloat, StrictInt]] = None + __properties: ClassVar[List[str]] = ["condition", "currency", "delivery", "delivery_price", "details", "discount", "domain", "in_stock", "installment", "link", "more_stores_page", "name", "original_price", "payment_methods", "position", "price", "promotion", "returns", "shown", "store_rating", "store_reviews", "tag", "title", "total_price"] + + @field_validator('shown') + def shown_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['page', 'more_stores']): + raise ValueError("must be one of enum values ('page', 'more_stores')") + return value + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ShoppingSellerModel from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of installment + if self.installment: + _dict['installment'] = self.installment.to_dict() + # override the default output from pydantic by calling `to_dict()` of promotion + if self.promotion: + _dict['promotion'] = self.promotion.to_dict() + # set to None if condition (nullable) is None + # and model_fields_set contains the field + if self.condition is None and "condition" in self.model_fields_set: + _dict['condition'] = None + + # set to None if currency (nullable) is None + # and model_fields_set contains the field + if self.currency is None and "currency" in self.model_fields_set: + _dict['currency'] = None + + # set to None if delivery (nullable) is None + # and model_fields_set contains the field + if self.delivery is None and "delivery" in self.model_fields_set: + _dict['delivery'] = None + + # set to None if delivery_price (nullable) is None + # and model_fields_set contains the field + if self.delivery_price is None and "delivery_price" in self.model_fields_set: + _dict['delivery_price'] = None + + # set to None if discount (nullable) is None + # and model_fields_set contains the field + if self.discount is None and "discount" in self.model_fields_set: + _dict['discount'] = None + + # set to None if domain (nullable) is None + # and model_fields_set contains the field + if self.domain is None and "domain" in self.model_fields_set: + _dict['domain'] = None + + # set to None if in_stock (nullable) is None + # and model_fields_set contains the field + if self.in_stock is None and "in_stock" in self.model_fields_set: + _dict['in_stock'] = None + + # set to None if installment (nullable) is None + # and model_fields_set contains the field + if self.installment is None and "installment" in self.model_fields_set: + _dict['installment'] = None + + # set to None if link (nullable) is None + # and model_fields_set contains the field + if self.link is None and "link" in self.model_fields_set: + _dict['link'] = None + + # set to None if more_stores_page (nullable) is None + # and model_fields_set contains the field + if self.more_stores_page is None and "more_stores_page" in self.model_fields_set: + _dict['more_stores_page'] = None + + # set to None if name (nullable) is None + # and model_fields_set contains the field + if self.name is None and "name" in self.model_fields_set: + _dict['name'] = None + + # set to None if original_price (nullable) is None + # and model_fields_set contains the field + if self.original_price is None and "original_price" in self.model_fields_set: + _dict['original_price'] = None + + # set to None if price (nullable) is None + # and model_fields_set contains the field + if self.price is None and "price" in self.model_fields_set: + _dict['price'] = None + + # set to None if promotion (nullable) is None + # and model_fields_set contains the field + if self.promotion is None and "promotion" in self.model_fields_set: + _dict['promotion'] = None + + # set to None if returns (nullable) is None + # and model_fields_set contains the field + if self.returns is None and "returns" in self.model_fields_set: + _dict['returns'] = None + + # set to None if store_rating (nullable) is None + # and model_fields_set contains the field + if self.store_rating is None and "store_rating" in self.model_fields_set: + _dict['store_rating'] = None + + # set to None if store_reviews (nullable) is None + # and model_fields_set contains the field + if self.store_reviews is None and "store_reviews" in self.model_fields_set: + _dict['store_reviews'] = None + + # set to None if tag (nullable) is None + # and model_fields_set contains the field + if self.tag is None and "tag" in self.model_fields_set: + _dict['tag'] = None + + # set to None if title (nullable) is None + # and model_fields_set contains the field + if self.title is None and "title" in self.model_fields_set: + _dict['title'] = None + + # set to None if total_price (nullable) is None + # and model_fields_set contains the field + if self.total_price is None and "total_price" in self.model_fields_set: + _dict['total_price'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ShoppingSellerModel from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "condition": obj.get("condition"), + "currency": obj.get("currency"), + "delivery": obj.get("delivery"), + "delivery_price": obj.get("delivery_price"), + "details": obj.get("details"), + "discount": obj.get("discount"), + "domain": obj.get("domain"), + "in_stock": obj.get("in_stock"), + "installment": ShoppingInstallmentModel.from_dict(obj["installment"]) if obj.get("installment") is not None else None, + "link": obj.get("link"), + "more_stores_page": obj.get("more_stores_page"), + "name": obj.get("name"), + "original_price": obj.get("original_price"), + "payment_methods": obj.get("payment_methods"), + "position": obj.get("position"), + "price": obj.get("price"), + "promotion": ShoppingPromotionModel.from_dict(obj["promotion"]) if obj.get("promotion") is not None else None, + "returns": obj.get("returns"), + "shown": obj.get("shown"), + "store_rating": obj.get("store_rating"), + "store_reviews": obj.get("store_reviews"), + "tag": obj.get("tag"), + "title": obj.get("title"), + "total_price": obj.get("total_price") + }) + return _obj diff --git a/openapi.json b/openapi.json index 1a8b749..e160fc7 100644 --- a/openapi.json +++ b/openapi.json @@ -1,6 +1,58 @@ { "components": { "schemas": { + "AiOverviewModel": { + "properties": { + "sources": { + "description": "The sources Google cites for it", + "items": { + "$ref": "#/components/schemas/AiSourceModel" + }, + "title": "Sources", + "type": "array" + }, + "text": { + "description": "The overview's text: a paragraph or heading per line, list items starting with •", + "title": "Text", + "type": "string" + }, + "via": { + "description": "\"page\": it came in the results page; \"async\": Google loads it after the page, and it was asked for", + "enum": [ + "page", + "async" + ], + "title": "Via", + "type": "string" + } + }, + "required": [ + "text", + "via" + ], + "title": "AiOverviewModel", + "type": "object" + }, + "AiSourceModel": { + "properties": { + "title": { + "description": "The source page's title, as Google's source card shows it", + "title": "Title", + "type": "string" + }, + "url": { + "description": "Google's redirect link to the source (https://www.google.com/goto?url=…), not the source's own URL", + "title": "Url", + "type": "string" + } + }, + "required": [ + "title", + "url" + ], + "title": "AiSourceModel", + "type": "object" + }, "BatchAccepted": { "properties": { "accepted_urls": { @@ -93,7 +145,7 @@ "type": "null" } ], - "description": "Custom HTTP headers included in each batch item extraction request", + "description": "Custom HTTP headers included in each batch item extraction request, without dropped headers", "title": "Headers" }, "proxy": { @@ -125,6 +177,34 @@ "title": "BatchConfig", "type": "object" }, + "BatchDownloadResponse": { + "properties": { + "download_url": { + "description": "Temporary link to a zip with one file per successful URL in the batch's formats and a manifest.json of the URLs without a file", + "title": "Download Url", + "type": "string" + }, + "expires_at": { + "description": "When the link stops working; ask again for a new one", + "format": "date-time", + "title": "Expires At", + "type": "string" + }, + "job_id": { + "description": "Unique job identifier", + "format": "uuid", + "title": "Job Id", + "type": "string" + } + }, + "required": [ + "job_id", + "download_url", + "expires_at" + ], + "title": "BatchDownloadResponse", + "type": "object" + }, "BatchItemMetadata": { "properties": { "duration_ms": { @@ -279,7 +359,7 @@ "type": "null" } ], - "description": "Custom HTTP headers to include in extraction requests", + "description": "Custom HTTP headers to include in extraction requests. `Host` and `:authority` are dropped: the target host always comes from each item's URL", "title": "Headers" }, "ignore_invalid_urls": { @@ -1310,7 +1390,7 @@ "type": "null" } ], - "description": "Custom HTTP headers to include in extraction request. `Accept-Language` is the one exception on browser-rendered requests: it is not forwarded verbatim, because it would override the header the browser derives from its locale and leave the wire value contradicting `navigator.language`. The language you ask for is still honoured — it selects the browser locale, paired with the proxy country's region, so `en-US` through a German proxy renders the page as `en-DE`.", + "description": "Custom HTTP headers to include in extraction request. `Accept-Language` is the one exception on browser-rendered requests: it is not forwarded verbatim, because it would override the header the browser derives from its locale and leave the wire value contradicting `navigator.language`. The language you ask for is still honoured — it selects the browser locale, paired with the proxy country's region, so `en-US` through a German proxy renders the page as `en-DE`. `Host` and `:authority` are dropped: the target host always comes from `url`.", "title": "Headers" }, "processing_mode": { @@ -1348,7 +1428,7 @@ "type": "null" } ], - "description": "Milliseconds this request may take, counted from when we receive it and including any queue wait. On expiry the escalation chain stops rather than the response merely arriving sooner: no further browser is launched, and the request is not billed. Omit it to keep the system ceiling. Sync requests only: sending it with processing_mode=async is rejected rather than ignored, because an async caller holds a job id and polls at its own pace. Values above the ceiling are clamped to it.", + "description": "Milliseconds this request may take, counted from when we receive it and including any queue wait. A wait for the per-site rate limit or for a free thread uses the same time: when it does not fit, the request is refused with 429 instead of being held longer. On expiry the escalation chain stops rather than the response merely arriving sooner: no further browser is launched, and the request is not billed. Omit it to keep the system ceiling. Sync requests only: sending it with processing_mode=async is rejected rather than ignored, because an async caller holds a job id and polls at its own pace. Values above the ceiling are clamped to it.", "title": "Timeout" }, "url": { @@ -1500,7 +1580,9 @@ "CANCELLED", "PAYMENT_REQUIRED", "INTERNAL_ERROR", - "PROXY_ERROR" + "PROXY_ERROR", + "TARGET_BLOCKED", + "GOOGLE_SEARCH_MOVED" ], "title": "ExtractionErrorCode", "type": "string" @@ -1558,7 +1640,7 @@ "type": "null" } ], - "description": "Custom HTTP headers that were requested for the extraction. `Accept-Language` is echoed here as it was sent; on browser-rendered requests the header actually transmitted is derived from the resolved locale instead.", + "description": "Custom HTTP headers that were forwarded for the extraction, after dropped headers (`Host`, `:authority`) are removed. `Accept-Language` is echoed here as it was sent; on browser-rendered requests the header actually transmitted is derived from the resolved locale instead.", "title": "Headers" }, "http_status": { @@ -1619,747 +1701,1579 @@ "title": "ExtractionMetadata", "type": "object" }, - "HTTPValidationError": { - "properties": { - "detail": { - "items": { - "$ref": "#/components/schemas/ValidationError" - }, - "title": "Detail", - "type": "array" - } - }, - "title": "HTTPValidationError", - "type": "object" - }, - "HealthResponse": { - "properties": { - "service": { - "title": "Service", - "type": "string" - }, - "status": { - "$ref": "#/components/schemas/HealthStatus" - }, - "timestamp": { - "format": "date-time", - "title": "Timestamp", - "type": "string" - }, - "version": { - "title": "Version", - "type": "string" - } - }, - "required": [ - "version", - "service", - "timestamp", - "status" - ], - "title": "HealthResponse", - "type": "object" - }, - "HealthStatus": { - "enum": [ - "ok", - "degraded", - "unavailable" - ], - "title": "HealthStatus", - "type": "string" - }, - "JobCollectionResponse": { - "properties": { - "is_capped": { - "default": false, - "description": "True if page_count is capped: the account has more matching jobs than page_count reflects, but the exact total isn't computed at this scale", - "title": "Is Capped", - "type": "boolean" - }, - "jobs": { - "description": "List of jobs", - "items": { - "$ref": "#/components/schemas/JobListItemResponse" - }, - "title": "Jobs", - "type": "array" - }, - "page": { - "description": "Current page number", - "title": "Page", - "type": "integer" - }, - "page_count": { - "description": "Total number of pages", - "title": "Page Count", - "type": "integer" - }, - "page_size": { - "description": "Number of items per page", - "title": "Page Size", - "type": "integer" - } - }, - "required": [ - "jobs", - "page", - "page_size", - "page_count" - ], - "title": "JobCollectionResponse", - "type": "object" - }, - "JobListItemResponse": { + "GoogleSearchLightPage": { + "description": "One result page. It carries what the request's `format` names: \"json\" the parsed results, \"html\" the page\nitself, \"both\" all of it.", "properties": { - "created_at": { - "description": "Date when job was created", - "format": "date-time", - "title": "Created At", - "type": "string" - }, - "execution_time": { + "ai_overview": { "anyOf": [ { - "type": "integer" + "$ref": "#/components/schemas/AiOverviewModel" }, { "type": "null" } ], - "description": "Execution time in milliseconds", - "title": "Execution Time" - }, - "job_id": { - "description": "Job ID", - "format": "uuid", - "title": "Job Id", - "type": "string" - }, - "output": { - "description": "Output formats requested", - "items": { - "$ref": "#/components/schemas/OutputFormat" - }, - "title": "Output", - "type": "array" + "description": "Google's AI Overview, on page 1 when asked for (`ai_overview`; \"json\" and \"both\")" }, - "status": { - "$ref": "#/components/schemas/JobStatus", - "description": "Current job status" + "attempts": { + "description": "Number of upstream attempts made for this page", + "title": "Attempts", + "type": "integer" }, - "url": { - "description": "URL to extract content from", - "title": "Url", - "type": "string" - } - }, - "required": [ - "job_id", - "status", - "url", - "created_at" - ], - "title": "JobListItemResponse", - "type": "object" - }, - "JobStatus": { - "enum": [ - "queued", - "processing", - "completed", - "failed", - "cancelled" - ], - "title": "JobStatus", - "type": "string" - }, - "JobStatusResponse": { - "properties": { - "completed_at": { + "html": { "anyOf": [ { - "format": "date-time", "type": "string" }, { "type": "null" } ], - "description": "When job completed (null if still processing)", - "title": "Completed At" + "description": "The page as Google sent it, with `ai_overview` its AI Overview written in (\"html\" and \"both\")", + "title": "Html" }, - "created_at": { - "description": "When job was created", - "format": "date-time", - "title": "Created At", - "type": "string" + "page": { + "description": "Result page", + "title": "Page", + "type": "integer" }, - "data": { + "results": { "anyOf": [ { - "$ref": "#/components/schemas/ExtractionData" + "items": { + "$ref": "#/components/schemas/SearchHitModel" + }, + "type": "array" }, { "type": "null" } ], - "description": "Extracted content (only when completed successfully)" + "description": "Organic results, in page order (\"json\" and \"both\")", + "title": "Results" }, - "error": { + "spelling_correction": { "anyOf": [ { - "$ref": "#/components/schemas/ExtractionError" + "type": "string" }, { "type": "null" } ], - "description": "Error details if job failed" - }, - "job_id": { - "description": "Job ID", - "title": "Job Id", - "type": "string" + "description": "Spelling correction applied to the query (\"json\" and \"both\")", + "title": "Spelling Correction" }, - "metadata": { + "suggestions": { "anyOf": [ { - "$ref": "#/components/schemas/ExtractionMetadata" + "items": { + "type": "string" + }, + "type": "array" }, { "type": "null" } ], - "description": "Execution metadata" - }, - "status": { - "$ref": "#/components/schemas/JobStatus", - "description": "Current job status" + "description": "Query suggestions returned by Google (\"json\" and \"both\")", + "title": "Suggestions" + } + }, + "required": [ + "page", + "attempts" + ], + "title": "GoogleSearchLightPage", + "type": "object" + }, + "GoogleSearchLightRequest": { + "properties": { + "ai_overview": { + "default": false, + "description": "Also return Google's AI Overview for the query, when Google gives one: as text and its sources (`ai_overview` in the response) with format \"json\" or \"both\", and written into the page, where Google's own JS would write it, with format \"html\" or \"both\" (its container marked `data-aio-written`). Page 1 only. Where Google loads it after the page, it is asked for too, which can add a few seconds; a search whose overview cannot be had still returns its results.", + "title": "AI Overview", + "type": "boolean" }, - "tokens_charged": { - "anyOf": [ - { - "type": "integer" - }, - { - "type": "null" - } + "device": { + "default": "desktop", + "description": "Whose results page to fetch: \"desktop\"; \"mobile\", Google's results as an Android phone gets them; \"iphone\" and \"ipad\", as Safari on an iPhone or an iPad gets them. Pages 2 and on follow the same device's page 1.", + "enum": [ + "desktop", + "mobile", + "iphone", + "ipad" ], - "description": "Tokens charged (only when completed successfully)", - "title": "Tokens Charged" - } - }, - "required": [ - "job_id", - "status", - "created_at" - ], - "title": "JobStatusResponse", - "type": "object" - }, - "MapJobDetailResponse": { - "properties": { - "completed_at": { + "examples": [ + "desktop", + "mobile", + "iphone", + "ipad" + ], + "title": "Device", + "type": "string" + }, + "format": { + "default": "json", + "description": "What each page of the answer carries: \"json\" the parsed results, \"html\" the page as Google sent it (Google's ordinary results page), \"both\" all of it. The answer is JSON whatever the format. With `Accept-Encoding: gzip`, \"html\" and \"both\" come gzip-compressed (`Content-Encoding: gzip`).", + "enum": [ + "json", + "html", + "both" + ], + "examples": [ + "json", + "html", + "both" + ], + "title": "Response format", + "type": "string" + }, + "locale": { "anyOf": [ { - "format": "date-time", "type": "string" }, { "type": "null" } ], - "description": "When the map job finished", - "title": "Completed At" + "description": "Locale tag: a language code ('en'), a language-region tag ('en-US'), or 'all'.", + "title": "Locale" }, - "created_at": { - "description": "When the map job was created", - "format": "date-time", - "title": "Created At", + "page": { + "default": 1, + "description": "Result page to fetch, 1 to 20. Every page is its own search and is billed as one. Ask for a query's pages in order: the next page is served from the same Google session as the last one.", + "examples": [ + 1, + 2, + 5 + ], + "maximum": 20.0, + "minimum": 1.0, + "title": "Result page", + "type": "integer" + }, + "pages": { + "default": 1, + "description": "Pages 1 to `pages` (at most 10) in one request, fetched one after another through one Google session and exit IP, each by the previous page's own next-page link, and returned together in `pages`. Billed per page returned: the request stops at the first page that fails or that Google does not have, and answers with the pages before it. From page 1; not with `url`.", + "examples": [ + 1, + 3, + 5 + ], + "maximum": 10.0, + "minimum": 1.0, + "title": "Pages", + "type": "integer" + }, + "query": { + "default": "", + "description": "Search query. Required unless `url` is given, which carries the query itself (`q`).", + "maxLength": 1000, + "title": "Query", "type": "string" }, - "duration_ms": { - "anyOf": [ - { - "type": "integer" - }, - { - "type": "null" - } + "safe": { + "default": "off", + "description": "Safe-search filtering level. Accepted values: \"off\", \"moderate\", or \"strict\".", + "enum": [ + "off", + "moderate", + "strict" ], - "description": "Execution time in milliseconds", - "title": "Duration Ms" + "examples": [ + "off", + "moderate", + "strict" + ], + "title": "Safe-search level", + "type": "string" }, - "error_code": { + "time_range": { "anyOf": [ { + "enum": [ + "day", + "week", + "month", + "year" + ], "type": "string" }, { "type": "null" } ], - "description": "Machine-readable error code for failed jobs", - "title": "Error Code" + "description": "Restrict results to a recency window. Accepted values: \"day\", \"week\", \"month\", or \"year\".", + "examples": [ + "day", + "week", + "month", + "year" + ], + "title": "Time range" }, - "error_message": { + "url": { "anyOf": [ { + "maxLength": 2048, "type": "string" }, { "type": "null" } ], - "description": "Human-readable error description", - "title": "Error Message" - }, - "ignore_query_parameters": { - "description": "Whether query parameters were stripped", - "title": "Ignore Query Parameters", - "type": "boolean" - }, - "include_subdomains": { - "description": "Whether sibling subdomains were probed", - "title": "Include Subdomains", - "type": "boolean" - }, - "job_id": { - "description": "Unique job identifier", - "format": "uuid", - "title": "Job Id", - "type": "string" - }, - "links": { - "anyOf": [ - { - "items": { - "$ref": "#/components/schemas/MapLink" - }, - "type": "array" - }, - { - "type": "null" - } + "description": "A complete Google results URL to fetch exactly as given, in place of `query`: `https://www.google.com/search?q=...` with whatever of Google's own parameters it carries (`hl`, `gl`, `uule`, `start`, `tbs`, ...). Nothing is added, removed or reordered. Only www.google.com and the full results page (no `tbm`, no `udm`). Not with `query`, `locale`, `page`, `safe`, `time_range` or `uule`, which the URL carries itself; `device`, `format` and `ai_overview` apply as usual.", + "examples": [ + "https://www.google.com/search?q=coffee+grinder&hl=en&gl=us&start=10" ], - "description": "Discovered URLs with their discovery source", - "title": "Links" - }, - "links_count": { - "default": 0, - "description": "Number of URLs discovered", - "title": "Links Count", - "type": "integer" + "title": "Google results URL" }, - "search": { + "uule": { "anyOf": [ { + "maxLength": 512, "type": "string" }, { "type": "null" } ], - "description": "Search filter applied during discovery, if any", - "title": "Search" - }, - "status": { - "$ref": "#/components/schemas/JobStatus", - "description": "Job status" - }, - "tokens_charged": { - "default": 0, - "description": "Tokens charged for this job", - "title": "Tokens Charged", - "type": "integer" - }, - "url": { - "description": "Base URL that was mapped", - "title": "Url", - "type": "string" + "description": "Search as if from this place: a Google UULE, either a place name (\"w+CAIQICI…\", e.g. a ZIP code, city or state) or coordinates (\"a+…\"). Pages 2 and on follow the same place's page 1.", + "examples": [ + "w+CAIQICIaQXVzdGluLFRleGFzLFVuaXRlZCBTdGF0ZXM" + ], + "title": "Location (UULE)" } }, - "required": [ - "job_id", - "url", - "status", - "include_subdomains", - "ignore_query_parameters", - "created_at" - ], - "title": "MapJobDetailResponse", + "title": "GoogleSearchLightRequest", "type": "object" }, - "MapJobsResponse": { + "GoogleSearchLightResponse": { + "description": "One shape for every request, of one page or several (`pages`).", "properties": { - "jobs": { + "job_id": { + "description": "Unique job identifier for this request", + "format": "uuid", + "title": "Job Id", + "type": "string" + }, + "pages": { + "description": "The pages, page 1 first", "items": { - "$ref": "#/components/schemas/MapListItemResponse" + "$ref": "#/components/schemas/GoogleSearchLightPage" }, - "title": "Jobs", + "title": "Pages", "type": "array" }, - "page": { - "title": "Page", + "pages_requested": { + "description": "Pages asked for (`pages`; 1 without it)", + "title": "Pages Requested", "type": "integer" }, - "page_count": { - "title": "Page Count", + "pages_returned": { + "description": "Pages returned, and billed", + "title": "Pages Returned", "type": "integer" }, - "page_size": { - "title": "Page Size", - "type": "integer" - } - }, - "required": [ - "jobs", - "page", - "page_size", - "page_count" - ], - "title": "MapJobsResponse", - "type": "object" - }, - "MapLink": { - "properties": { - "source": { - "description": "Discovery source: sitemap or html", - "enum": [ - "sitemap", - "html" + "pages_stopped": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } ], - "title": "Source", - "type": "string" + "description": "Why fewer pages than asked came back: no_results (Google has no further page), blocked, upstream_unreachable, timeout, warming_up, clock or error. Null when all of them did.", + "title": "Pages Stopped" }, - "url": { - "description": "Discovered URL", - "title": "Url", + "query": { + "description": "Search query that was submitted", + "title": "Query", "type": "string" } }, "required": [ - "url", - "source" + "job_id", + "query", + "pages_requested", + "pages_returned", + "pages" ], - "title": "MapLink", + "title": "GoogleSearchLightResponse", "type": "object" }, - "MapListItemResponse": { + "GoogleShoppingProductRequest": { "properties": { - "completed_at": { + "catalog_id": { "anyOf": [ { - "format": "date-time", + "pattern": "^\\d{5,25}$", "type": "string" }, { "type": "null" } ], - "description": "When the map job finished", - "title": "Completed At" + "description": "Google's catalog id of the product. Give this or `url`, not both.", + "examples": [ + "11018290803738983204" + ], + "title": "Catalog id" }, - "created_at": { - "description": "When the map job was created", - "format": "date-time", - "title": "Created At", - "type": "string" + "more_stores": { + "default": 3, + "description": "How many times to ask for \"More stores\" at most. The product's page shows its first stores (three when there are more); each ask adds up to ten. 0 returns the page's stores only. Asking stops by itself at the end of the list. The price of a request does not depend on it.", + "examples": [ + 0, + 3, + 15 + ], + "maximum": 15.0, + "minimum": 0.0, + "title": "More stores", + "type": "integer" }, - "duration_ms": { + "url": { "anyOf": [ { - "type": "integer" + "maxLength": 2048, + "type": "string" }, { "type": "null" } ], - "description": "Execution time in milliseconds", - "title": "Duration Ms" - }, - "error_code": { - "anyOf": [ + "description": "A Google Shopping product link that names a catalog id (`…/search?ibp=oshop&prds=catalogid:`), in place of `catalog_id`. Only the id is taken from it: the product is asked for as a US buyer in English.", + "examples": [ + "https://www.google.com/search?ibp=oshop&q=+&prds=catalogid%3A11018290803738983204" + ], + "title": "Product link" + } + }, + "title": "GoogleShoppingProductRequest", + "type": "object" + }, + "GoogleShoppingProductResponse": { + "properties": { + "attempts": { + "description": "How many Google sessions the product was asked through", + "title": "Attempts", + "type": "integer" + }, + "catalog_id": { + "description": "The catalog id that was asked for", + "title": "Catalog Id", + "type": "string" + }, + "complete": { + "anyOf": [ { - "type": "string" + "type": "boolean" }, { "type": "null" } ], - "description": "Machine-readable error code for failed jobs", - "title": "Error Code" + "description": "Whether `sellers` is the product's whole list. False when `more_stores`, the request's time or a refusal part of the way ended it first.", + "title": "Complete" }, "job_id": { - "description": "Unique job identifier", "format": "uuid", "title": "Job Id", "type": "string" }, - "links_count": { - "default": 0, - "description": "Number of URLs discovered", - "title": "Links Count", + "more_stores_pages": { + "description": "How many times \"More stores\" was asked for and answered", + "title": "More Stores Pages", "type": "integer" }, - "search": { + "product": { + "$ref": "#/components/schemas/ShoppingProductModel" + }, + "sellers": { + "description": "The product's stores, in Google's order", + "items": { + "$ref": "#/components/schemas/ShoppingSellerModel" + }, + "title": "Sellers", + "type": "array" + }, + "sellers_count": { + "description": "How many stores are in `sellers`", + "title": "Sellers Count", + "type": "integer" + }, + "sellers_total": { "anyOf": [ { - "type": "string" + "type": "integer" }, { "type": "null" } ], - "description": "Search filter applied during discovery, if any", - "title": "Search" - }, - "status": { - "$ref": "#/components/schemas/JobStatus", - "description": "Job status" - }, - "url": { - "description": "Base URL that was mapped", - "title": "Url", - "type": "string" + "description": "Google's own count of the product's stores, when its page states one. It and the list it comes with disagree by one to three stores on a few products in a hundred.", + "title": "Sellers Total" } }, "required": [ "job_id", - "url", - "status", - "created_at" + "catalog_id", + "product", + "sellers", + "sellers_count", + "more_stores_pages", + "attempts" ], - "title": "MapListItemResponse", + "title": "GoogleShoppingProductResponse", "type": "object" }, - "MapMetadata": { + "HTTPValidationError": { "properties": { - "duration_ms": { - "description": "Total discovery duration in milliseconds", - "title": "Duration Ms", - "type": "integer" + "detail": { + "items": { + "$ref": "#/components/schemas/ValidationError" + }, + "title": "Detail", + "type": "array" + } + }, + "title": "HTTPValidationError", + "type": "object" + }, + "HealthResponse": { + "properties": { + "service": { + "title": "Service", + "type": "string" }, - "links_count": { - "description": "Number of URLs discovered", - "title": "Links Count", - "type": "integer" + "status": { + "$ref": "#/components/schemas/HealthStatus" }, - "url": { - "description": "Base URL that was mapped", - "title": "Url", + "timestamp": { + "format": "date-time", + "title": "Timestamp", + "type": "string" + }, + "version": { + "title": "Version", "type": "string" } }, "required": [ - "url", - "duration_ms", - "links_count" + "version", + "service", + "timestamp", + "status" ], - "title": "MapMetadata", + "title": "HealthResponse", "type": "object" }, - "MapRequest": { + "HealthStatus": { + "enum": [ + "ok", + "degraded", + "unavailable" + ], + "title": "HealthStatus", + "type": "string" + }, + "JobCollectionResponse": { "properties": { - "ignore_query_parameters": { - "default": true, - "description": "Strip query parameters when normalizing discovered URLs", - "title": "Ignore Query Parameters", - "type": "boolean" - }, - "include_subdomains": { + "is_capped": { "default": false, - "description": "When false (default), discovery is scoped to the exact seed host only. When true, the scope widens to the whole registrable domain: sibling subdomains found in the seed's sitemap/HTML are kept, and common subdomains (docs, blog, help, support) are actively probed for their own sitemaps.", - "title": "Include Subdomains", + "description": "True if page_count is capped: the account has more matching jobs than page_count reflects, but the exact total isn't computed at this scale", + "title": "Is Capped", "type": "boolean" }, - "search": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "description": "Case-insensitive substring filter applied to discovered URLs. Does not query a search engine; only narrows results found via sitemap/HTML discovery.", - "title": "Search" + "jobs": { + "description": "List of jobs", + "items": { + "$ref": "#/components/schemas/JobListItemResponse" + }, + "title": "Jobs", + "type": "array" }, - "url": { - "description": "Base URL to discover links from. By default discovery is scoped to this exact host (treating a leading 'www.' as equivalent) and, when the URL has a path, to URLs under that path. Set include_subdomains=true to widen the scope.", - "format": "uri", - "minLength": 1, - "title": "Url", - "type": "string" + "page": { + "description": "Current page number", + "title": "Page", + "type": "integer" + }, + "page_count": { + "description": "Total number of pages", + "title": "Page Count", + "type": "integer" + }, + "page_size": { + "description": "Number of items per page", + "title": "Page Size", + "type": "integer" } }, "required": [ - "url" + "jobs", + "page", + "page_size", + "page_count" ], - "title": "MapRequest", + "title": "JobCollectionResponse", "type": "object" }, - "MapResponse": { + "JobListItemResponse": { "properties": { - "links": { - "description": "Discovered URLs with their discovery source", - "items": { - "$ref": "#/components/schemas/MapLink" - }, - "title": "Links", - "type": "array" + "created_at": { + "description": "Date when job was created", + "format": "date-time", + "title": "Created At", + "type": "string" }, - "metadata": { + "execution_time": { "anyOf": [ { - "$ref": "#/components/schemas/MapMetadata" + "type": "integer" }, { "type": "null" } ], - "description": "Diagnostic metadata about the discovery run" + "description": "Execution time in milliseconds", + "title": "Execution Time" }, - "success": { - "description": "Whether the request succeeded", - "title": "Success", - "type": "boolean" + "job_id": { + "description": "Job ID", + "format": "uuid", + "title": "Job Id", + "type": "string" }, - "warning": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "description": "Non-fatal advisory message", - "title": "Warning" + "output": { + "description": "Output formats requested", + "items": { + "$ref": "#/components/schemas/OutputFormat" + }, + "title": "Output", + "type": "array" + }, + "status": { + "$ref": "#/components/schemas/JobStatus", + "description": "Current job status" + }, + "url": { + "description": "URL to extract content from", + "title": "Url", + "type": "string" } }, "required": [ - "success" + "job_id", + "status", + "url", + "created_at" ], - "title": "MapResponse", + "title": "JobListItemResponse", "type": "object" }, - "OutputFormat": { - "enum": [ - "markdown", - "html" - ], - "title": "OutputFormat", - "type": "string" - }, - "ProcessingMode": { + "JobStatus": { "enum": [ - "sync", - "async" + "queued", + "processing", + "completed", + "failed", + "cancelled" ], - "title": "ProcessingMode", + "title": "JobStatus", "type": "string" }, - "ProxySettings": { + "JobStatusResponse": { "properties": { - "country": { + "completed_at": { "anyOf": [ { - "pattern": "^[A-Z]{2}$", + "format": "date-time", "type": "string" }, { "type": "null" } ], - "description": "ISO 3166-1 alpha-2 country code for geo-targeting (e.g., 'US', 'GB'). Codes that are not backed by a geo-targeted proxy pool are rejected rather than silently ignored. If null, the server auto-resolves a country from the target URL (domain/path overrides first, then the TLD). If no country can be inferred, the upstream proxy provider picks the exit region.", - "title": "Country" + "description": "When job completed (null if still processing)", + "title": "Completed At" }, - "type": { - "$ref": "#/components/schemas/ProxyType", - "default": "residential", - "description": "Type of proxy to use (datacenter or residential). Defaults to 'residential' when omitted." + "created_at": { + "description": "When job was created", + "format": "date-time", + "title": "Created At", + "type": "string" + }, + "data": { + "anyOf": [ + { + "$ref": "#/components/schemas/ExtractionData" + }, + { + "type": "null" + } + ], + "description": "Extracted content (only when completed successfully)" + }, + "error": { + "anyOf": [ + { + "$ref": "#/components/schemas/ExtractionError" + }, + { + "type": "null" + } + ], + "description": "Error details if job failed" + }, + "job_id": { + "description": "Job ID", + "title": "Job Id", + "type": "string" + }, + "metadata": { + "anyOf": [ + { + "$ref": "#/components/schemas/ExtractionMetadata" + }, + { + "type": "null" + } + ], + "description": "Execution metadata" + }, + "status": { + "$ref": "#/components/schemas/JobStatus", + "description": "Current job status" + }, + "tokens_charged": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "description": "Tokens charged (only when completed successfully)", + "title": "Tokens Charged" } }, - "title": "ProxySettings", - "type": "object" - }, - "ProxyType": { - "enum": [ - "datacenter", - "residential", - "mix" + "required": [ + "job_id", + "status", + "created_at" ], - "title": "ProxyType", - "type": "string" + "title": "JobStatusResponse", + "type": "object" }, - "RequestCountResponse": { + "MapJobDetailResponse": { "properties": { - "date": { - "description": "Date of the request count", + "completed_at": { + "anyOf": [ + { + "format": "date-time", + "type": "string" + }, + { + "type": "null" + } + ], + "description": "When the map job finished", + "title": "Completed At" + }, + "created_at": { + "description": "When the map job was created", "format": "date-time", - "title": "Date", + "title": "Created At", "type": "string" }, - "failed_request_count": { - "description": "Number of failed requests on this date", - "title": "Failed Request Count", + "duration_ms": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "description": "Execution time in milliseconds", + "title": "Duration Ms" + }, + "error_code": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "description": "Machine-readable error code for failed jobs", + "title": "Error Code" + }, + "error_message": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "description": "Human-readable error description", + "title": "Error Message" + }, + "ignore_query_parameters": { + "description": "Whether query parameters were stripped", + "title": "Ignore Query Parameters", + "type": "boolean" + }, + "include_subdomains": { + "description": "Whether sibling subdomains were probed", + "title": "Include Subdomains", + "type": "boolean" + }, + "job_id": { + "description": "Unique job identifier", + "format": "uuid", + "title": "Job Id", + "type": "string" + }, + "links": { + "anyOf": [ + { + "items": { + "$ref": "#/components/schemas/MapLink" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "description": "Discovered URLs with their discovery source", + "title": "Links" + }, + "links_count": { + "default": 0, + "description": "Number of URLs discovered", + "title": "Links Count", "type": "integer" }, - "success_request_count": { - "description": "Number of successful requests on this date", - "title": "Success Request Count", + "search": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "description": "Search filter applied during discovery, if any", + "title": "Search" + }, + "status": { + "$ref": "#/components/schemas/JobStatus", + "description": "Job status" + }, + "tokens_charged": { + "default": 0, + "description": "Tokens charged for this job", + "title": "Tokens Charged", "type": "integer" + }, + "url": { + "description": "Base URL that was mapped", + "title": "Url", + "type": "string" } }, "required": [ - "date", - "success_request_count", - "failed_request_count" + "job_id", + "url", + "status", + "include_subdomains", + "ignore_query_parameters", + "created_at" ], - "title": "RequestCountResponse", + "title": "MapJobDetailResponse", "type": "object" }, - "RotateSecretResponse": { + "MapJobsResponse": { "properties": { - "secret": { - "title": "Secret", - "type": "string" + "jobs": { + "items": { + "$ref": "#/components/schemas/MapListItemResponse" + }, + "title": "Jobs", + "type": "array" + }, + "page": { + "title": "Page", + "type": "integer" + }, + "page_count": { + "title": "Page Count", + "type": "integer" + }, + "page_size": { + "title": "Page Size", + "type": "integer" } }, "required": [ - "secret" + "jobs", + "page", + "page_size", + "page_count" + ], + "title": "MapJobsResponse", + "type": "object" + }, + "MapLink": { + "properties": { + "source": { + "description": "Discovery source: sitemap or html", + "enum": [ + "sitemap", + "html" + ], + "title": "Source", + "type": "string" + }, + "url": { + "description": "Discovered URL", + "title": "Url", + "type": "string" + } + }, + "required": [ + "url", + "source" + ], + "title": "MapLink", + "type": "object" + }, + "MapListItemResponse": { + "properties": { + "completed_at": { + "anyOf": [ + { + "format": "date-time", + "type": "string" + }, + { + "type": "null" + } + ], + "description": "When the map job finished", + "title": "Completed At" + }, + "created_at": { + "description": "When the map job was created", + "format": "date-time", + "title": "Created At", + "type": "string" + }, + "duration_ms": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "description": "Execution time in milliseconds", + "title": "Duration Ms" + }, + "error_code": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "description": "Machine-readable error code for failed jobs", + "title": "Error Code" + }, + "job_id": { + "description": "Unique job identifier", + "format": "uuid", + "title": "Job Id", + "type": "string" + }, + "links_count": { + "default": 0, + "description": "Number of URLs discovered", + "title": "Links Count", + "type": "integer" + }, + "search": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "description": "Search filter applied during discovery, if any", + "title": "Search" + }, + "status": { + "$ref": "#/components/schemas/JobStatus", + "description": "Job status" + }, + "url": { + "description": "Base URL that was mapped", + "title": "Url", + "type": "string" + } + }, + "required": [ + "job_id", + "url", + "status", + "created_at" + ], + "title": "MapListItemResponse", + "type": "object" + }, + "MapMetadata": { + "properties": { + "duration_ms": { + "description": "Total discovery duration in milliseconds", + "title": "Duration Ms", + "type": "integer" + }, + "links_count": { + "description": "Number of URLs discovered", + "title": "Links Count", + "type": "integer" + }, + "url": { + "description": "Base URL that was mapped", + "title": "Url", + "type": "string" + } + }, + "required": [ + "url", + "duration_ms", + "links_count" + ], + "title": "MapMetadata", + "type": "object" + }, + "MapRequest": { + "properties": { + "ignore_query_parameters": { + "default": true, + "description": "Strip query parameters when normalizing discovered URLs", + "title": "Ignore Query Parameters", + "type": "boolean" + }, + "include_subdomains": { + "default": false, + "description": "When false (default), discovery is scoped to the exact seed host only. When true, the scope widens to the whole registrable domain: sibling subdomains found in the seed's sitemap/HTML are kept, and common subdomains (docs, blog, help, support) are actively probed for their own sitemaps.", + "title": "Include Subdomains", + "type": "boolean" + }, + "search": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "description": "Case-insensitive substring filter applied to discovered URLs. Does not query a search engine; only narrows results found via sitemap/HTML discovery.", + "title": "Search" + }, + "url": { + "description": "Base URL to discover links from. By default discovery is scoped to this exact host (treating a leading 'www.' as equivalent) and, when the URL has a path, to URLs under that path. Set include_subdomains=true to widen the scope.", + "format": "uri", + "minLength": 1, + "title": "Url", + "type": "string" + } + }, + "required": [ + "url" + ], + "title": "MapRequest", + "type": "object" + }, + "MapResponse": { + "properties": { + "links": { + "description": "Discovered URLs with their discovery source", + "items": { + "$ref": "#/components/schemas/MapLink" + }, + "title": "Links", + "type": "array" + }, + "metadata": { + "anyOf": [ + { + "$ref": "#/components/schemas/MapMetadata" + }, + { + "type": "null" + } + ], + "description": "Diagnostic metadata about the discovery run" + }, + "success": { + "description": "Whether the request succeeded", + "title": "Success", + "type": "boolean" + }, + "warning": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "description": "Non-fatal advisory message", + "title": "Warning" + } + }, + "required": [ + "success" + ], + "title": "MapResponse", + "type": "object" + }, + "OutputFormat": { + "enum": [ + "markdown", + "html" + ], + "title": "OutputFormat", + "type": "string" + }, + "ProcessingMode": { + "enum": [ + "sync", + "async" + ], + "title": "ProcessingMode", + "type": "string" + }, + "ProxySettings": { + "properties": { + "country": { + "anyOf": [ + { + "pattern": "^[A-Z]{2}$", + "type": "string" + }, + { + "type": "null" + } + ], + "description": "ISO 3166-1 alpha-2 country code for geo-targeting (e.g., 'US', 'GB'). Codes that are not backed by a geo-targeted proxy pool are rejected rather than silently ignored. If null, the server auto-resolves a country from the target URL (domain/path overrides first, then the TLD). If no country can be inferred, the upstream proxy provider picks the exit region.", + "title": "Country" + }, + "type": { + "$ref": "#/components/schemas/ProxyType", + "default": "residential", + "description": "Type of proxy to use (datacenter or residential). Defaults to 'residential' when omitted." + } + }, + "title": "ProxySettings", + "type": "object" + }, + "ProxyType": { + "enum": [ + "datacenter", + "residential", + "mix" + ], + "title": "ProxyType", + "type": "string" + }, + "RequestCountResponse": { + "properties": { + "date": { + "description": "Date of the request count", + "format": "date-time", + "title": "Date", + "type": "string" + }, + "failed_request_count": { + "description": "Number of failed requests on this date", + "title": "Failed Request Count", + "type": "integer" + }, + "success_request_count": { + "description": "Number of successful requests on this date", + "title": "Success Request Count", + "type": "integer" + } + }, + "required": [ + "date", + "success_request_count", + "failed_request_count" + ], + "title": "RequestCountResponse", + "type": "object" + }, + "RotateSecretResponse": { + "properties": { + "secret": { + "title": "Secret", + "type": "string" + } + }, + "required": [ + "secret" + ], + "title": "RotateSecretResponse", + "type": "object" + }, + "SearchHitModel": { + "properties": { + "displayed_url": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "description": "Human-readable URL as shown by the engine", + "title": "Displayed Url" + }, + "position": { + "description": "1-based rank of this result on the page", + "title": "Position", + "type": "integer" + }, + "snippet": { + "default": "", + "description": "Result preview text", + "title": "Snippet", + "type": "string" + }, + "source_host": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "description": "Hostname the result was served from", + "title": "Source Host" + }, + "thumbnail": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "description": "Thumbnail image URL, if available", + "title": "Thumbnail" + }, + "title": { + "description": "Result title", + "title": "Title", + "type": "string" + }, + "url": { + "description": "Result target URL", + "title": "Url", + "type": "string" + } + }, + "required": [ + "position", + "title", + "url" + ], + "title": "SearchHitModel", + "type": "object" + }, + "SearchJobDetailResponse": { + "properties": { + "attempts": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "description": "Number of upstream attempts made", + "title": "Attempts" + }, + "block_reason": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "description": "Upstream block classification for failed jobs", + "title": "Block Reason" + }, + "completed_at": { + "anyOf": [ + { + "format": "date-time", + "type": "string" + }, + { + "type": "null" + } + ], + "description": "When the search job finished", + "title": "Completed At" + }, + "created_at": { + "description": "When the search job was created", + "format": "date-time", + "title": "Created At", + "type": "string" + }, + "duration_ms": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "description": "Execution time in milliseconds", + "title": "Duration Ms" + }, + "error_code": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "description": "Machine-readable error code for failed jobs", + "title": "Error Code" + }, + "error_message": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "description": "Human-readable error description", + "title": "Error Message" + }, + "final_url": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "description": "Final upstream URL that produced the results", + "title": "Final Url" + }, + "job_id": { + "description": "Unique job identifier", + "format": "uuid", + "title": "Job Id", + "type": "string" + }, + "locale": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "description": "BCP-47 locale tag, if requested", + "title": "Locale" + }, + "page": { + "description": "Result page that was requested", + "title": "Page", + "type": "integer" + }, + "query": { + "description": "Search query that was submitted", + "title": "Query", + "type": "string" + }, + "results": { + "anyOf": [ + { + "items": { + "$ref": "#/components/schemas/SearchHitModel" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "description": "Search results", + "title": "Results" + }, + "results_count": { + "default": 0, + "description": "Number of results returned", + "title": "Results Count", + "type": "integer" + }, + "safe": { + "description": "Safe-search level that was requested", + "enum": [ + "off", + "moderate", + "strict" + ], + "title": "Safe", + "type": "string" + }, + "spelling_correction": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "description": "Spelling correction applied to the query", + "title": "Spelling Correction" + }, + "status": { + "$ref": "#/components/schemas/JobStatus", + "description": "Job status" + }, + "suggestions": { + "description": "Query suggestions returned by the engine", + "items": { + "type": "string" + }, + "title": "Suggestions", + "type": "array" + }, + "time_range": { + "anyOf": [ + { + "enum": [ + "day", + "week", + "month", + "year" + ], + "type": "string" + }, + { + "type": "null" + } + ], + "description": "Time range filter, if requested", + "title": "Time Range" + }, + "tokens_charged": { + "default": 0, + "description": "Tokens charged for this job", + "title": "Tokens Charged", + "type": "integer" + } + }, + "required": [ + "job_id", + "query", + "page", + "safe", + "status", + "created_at" + ], + "title": "SearchJobDetailResponse", + "type": "object" + }, + "SearchJobsResponse": { + "properties": { + "jobs": { + "description": "Search jobs on this page", + "items": { + "$ref": "#/components/schemas/SearchListItemResponse" + }, + "title": "Jobs", + "type": "array" + }, + "page": { + "description": "Current page number", + "title": "Page", + "type": "integer" + }, + "page_count": { + "description": "Total number of pages available", + "title": "Page Count", + "type": "integer" + }, + "page_size": { + "description": "Number of jobs per page", + "title": "Page Size", + "type": "integer" + } + }, + "required": [ + "jobs", + "page", + "page_size", + "page_count" + ], + "title": "SearchJobsResponse", + "type": "object" + }, + "SearchListItemResponse": { + "properties": { + "block_reason": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "description": "Upstream block classification for failed jobs", + "title": "Block Reason" + }, + "completed_at": { + "anyOf": [ + { + "format": "date-time", + "type": "string" + }, + { + "type": "null" + } + ], + "description": "When the search job finished", + "title": "Completed At" + }, + "created_at": { + "description": "When the search job was created", + "format": "date-time", + "title": "Created At", + "type": "string" + }, + "duration_ms": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "description": "Execution time in milliseconds", + "title": "Duration Ms" + }, + "error_code": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "description": "Machine-readable error code for failed jobs", + "title": "Error Code" + }, + "job_id": { + "description": "Unique job identifier", + "format": "uuid", + "title": "Job Id", + "type": "string" + }, + "query": { + "description": "Search query that was submitted", + "title": "Query", + "type": "string" + }, + "results_count": { + "default": 0, + "description": "Number of results returned", + "title": "Results Count", + "type": "integer" + }, + "status": { + "$ref": "#/components/schemas/JobStatus", + "description": "Job status" + } + }, + "required": [ + "job_id", + "query", + "status", + "created_at" ], - "title": "RotateSecretResponse", + "title": "SearchListItemResponse", "type": "object" }, - "SearchHitModel": { + "SearchRequest": { "properties": { - "displayed_url": { + "engine": { "anyOf": [ { + "enum": [ + "duckduckgo", + "yahoo", + "naver" + ], "type": "string" }, { "type": "null" } ], - "description": "Human-readable URL as shown by the engine", - "title": "Displayed Url" - }, - "position": { - "description": "1-based rank of this result on the page", - "title": "Position", - "type": "integer" - }, - "snippet": { - "default": "", - "description": "Result preview text", - "title": "Snippet", - "type": "string" + "description": "Pin the search to one engine, with no fallback to any other. Omit to let the service rotate across its engines and fall back on failure, which is what most callers want. Pinning trades reliability for control: a single engine having a bad moment becomes your error instead of being routed around.", + "examples": [ + "duckduckgo", + "yahoo", + "naver" + ], + "title": "Search engine" }, - "source_host": { + "locale": { "anyOf": [ { "type": "string" @@ -2368,98 +3282,224 @@ "type": "null" } ], - "description": "Hostname the result was served from", - "title": "Source Host" + "description": "Locale tag: a language code ('en'), a language-region tag ('en-US'), or 'all'. Omit for no preference; duckduckgo is then searched in en-US.", + "title": "Locale" }, - "thumbnail": { + "page": { + "default": 1, + "description": "Result page to fetch. Without `engine`, 1 to 9. With `engine` set, the pinned engine's own limit applies instead: duckduckgo 5, naver 9, yahoo 9.", + "examples": [ + 1, + 2, + 9 + ], + "maximum": 9.0, + "minimum": 1.0, + "title": "Result page", + "type": "integer" + }, + "query": { + "description": "Search query", + "maxLength": 1000, + "minLength": 1, + "title": "Query", + "type": "string" + }, + "safe": { + "default": "off", + "description": "Safe-search filtering level. Accepted values: \"off\", \"moderate\", or \"strict\".", + "enum": [ + "off", + "moderate", + "strict" + ], + "examples": [ + "off", + "moderate", + "strict" + ], + "title": "Safe-search level", + "type": "string" + }, + "time_range": { "anyOf": [ { + "enum": [ + "day", + "week", + "month", + "year" + ], "type": "string" }, { "type": "null" } ], - "description": "Thumbnail image URL, if available", - "title": "Thumbnail" - }, - "title": { - "description": "Result title", - "title": "Title", - "type": "string" - }, - "url": { - "description": "Result target URL", - "title": "Url", - "type": "string" + "description": "Restrict results to a recency window. Accepted values: \"day\", \"week\", \"month\", or \"year\". Some engines honour fewer: yahoo day/month/week. Pinned to one of them, any other value is rejected; without `engine`, that engine is skipped.", + "examples": [ + "day", + "week", + "month", + "year" + ], + "title": "Time range" } }, "required": [ - "position", - "title", - "url" + "query" ], - "title": "SearchHitModel", + "title": "SearchRequest", "type": "object" }, - "SearchJobDetailResponse": { + "SearchResponse": { "properties": { "attempts": { + "description": "Number of upstream attempts made", + "title": "Attempts", + "type": "integer" + }, + "engine": { + "description": "Engine that actually served these results", + "title": "Engine", + "type": "string" + }, + "job_id": { + "description": "Unique job identifier for this search", + "format": "uuid", + "title": "Job Id", + "type": "string" + }, + "page": { + "description": "Result page that was returned", + "title": "Page", + "type": "integer" + }, + "query": { + "description": "Search query that was submitted", + "title": "Query", + "type": "string" + }, + "results": { + "description": "Search results", + "items": { + "$ref": "#/components/schemas/SearchHitModel" + }, + "title": "Results", + "type": "array" + }, + "spelling_correction": { "anyOf": [ { - "type": "integer" + "type": "string" }, { "type": "null" } ], - "description": "Number of upstream attempts made", - "title": "Attempts" + "description": "Spelling correction applied to the query", + "title": "Spelling Correction" }, - "block_reason": { + "suggestions": { + "description": "Query suggestions returned by the engine", + "items": { + "type": "string" + }, + "title": "Suggestions", + "type": "array" + } + }, + "required": [ + "job_id", + "engine", + "query", + "page", + "attempts", + "results", + "suggestions" + ], + "title": "SearchResponse", + "type": "object" + }, + "ShoppingInstallmentModel": { + "properties": { + "down_payment": { "anyOf": [ { - "type": "string" + "type": "number" }, { "type": "null" } ], - "description": "Upstream block classification for failed jobs", - "title": "Block Reason" + "description": "What is paid at once, when Google says", + "title": "Down Payment" }, - "completed_at": { + "monthly_price": { + "description": "What is paid each month", + "title": "Monthly Price", + "type": "number" + }, + "months": { + "description": "For how many months", + "title": "Months", + "type": "integer" + } + }, + "required": [ + "monthly_price", + "months" + ], + "title": "ShoppingInstallmentModel", + "type": "object" + }, + "ShoppingProductModel": { + "properties": { + "brand": { "anyOf": [ { - "format": "date-time", "type": "string" }, { "type": "null" } ], - "description": "When the search job finished", - "title": "Completed At" + "title": "Brand" }, - "created_at": { - "description": "When the search job was created", - "format": "date-time", - "title": "Created At", + "catalog_id": { + "description": "Google's catalog id of the product", + "title": "Catalog Id", "type": "string" }, - "duration_ms": { + "images": { + "description": "The product's pictures, as Google hosts them", + "items": { + "type": "string" + }, + "title": "Images", + "type": "array" + }, + "title": { "anyOf": [ { - "type": "integer" + "type": "string" }, { "type": "null" } ], - "description": "Execution time in milliseconds", - "title": "Duration Ms" - }, - "error_code": { + "title": "Title" + } + }, + "required": [ + "catalog_id" + ], + "title": "ShoppingProductModel", + "type": "object" + }, + "ShoppingPromotionModel": { + "properties": { + "code": { "anyOf": [ { "type": "string" @@ -2468,10 +3508,10 @@ "type": "null" } ], - "description": "Machine-readable error code for failed jobs", - "title": "Error Code" + "description": "The code that claims it, when there is one", + "title": "Code" }, - "error_message": { + "expires": { "anyOf": [ { "type": "string" @@ -2480,10 +3520,24 @@ "type": "null" } ], - "description": "Human-readable error description", - "title": "Error Message" + "description": "When it ends, as Google words it: \"Expires in 7 days\"", + "title": "Expires" }, - "final_url": { + "title": { + "description": "What the store offers on top of its price: \"10% off Fall Seasonal Categories\"", + "title": "Title", + "type": "string" + } + }, + "required": [ + "title" + ], + "title": "ShoppingPromotionModel", + "type": "object" + }, + "ShoppingSellerModel": { + "properties": { + "condition": { "anyOf": [ { "type": "string" @@ -2492,16 +3546,10 @@ "type": "null" } ], - "description": "Final upstream URL that produced the results", - "title": "Final Url" - }, - "job_id": { - "description": "Unique job identifier", - "format": "uuid", - "title": "Job Id", - "type": "string" + "description": "\"Pre-owned\", \"Refurbished\"; absent on a new one", + "title": "Condition" }, - "locale": { + "currency": { "anyOf": [ { "type": "string" @@ -2510,148 +3558,54 @@ "type": "null" } ], - "description": "BCP-47 locale tag, if requested", - "title": "Locale" + "description": "ISO currency of every amount in the row", + "title": "Currency" }, - "page": { - "description": "Result page that was requested", - "title": "Page", - "type": "integer" - }, - "query": { - "description": "Search query that was submitted", - "title": "Query", - "type": "string" - }, - "results": { + "delivery": { "anyOf": [ - { - "items": { - "$ref": "#/components/schemas/SearchHitModel" - }, - "type": "array" + { + "type": "string" }, { "type": "null" } ], - "description": "Search results", - "title": "Results" - }, - "results_count": { - "default": 0, - "description": "Number of results returned", - "title": "Results Count", - "type": "integer" - }, - "safe": { - "description": "Safe-search level that was requested", - "enum": [ - "off", - "moderate", - "strict" - ], - "title": "Safe", - "type": "string" + "description": "\"Free delivery between Oct 13 – 20\"", + "title": "Delivery" }, - "spelling_correction": { + "delivery_price": { "anyOf": [ { - "type": "string" + "type": "number" }, { "type": "null" } ], - "description": "Spelling correction applied to the query", - "title": "Spelling Correction" + "description": "What delivery costs: 0 when free, absent when Google does not say", + "title": "Delivery Price" }, - "status": { - "$ref": "#/components/schemas/JobStatus", - "description": "Job status" - }, - "suggestions": { - "description": "Query suggestions returned by the engine", + "details": { + "description": "Whatever else the store's row says", "items": { "type": "string" }, - "title": "Suggestions", + "title": "Details", "type": "array" }, - "time_range": { + "discount": { "anyOf": [ { - "enum": [ - "day", - "week", - "month", - "year" - ], "type": "string" }, { "type": "null" } ], - "description": "Time range filter, if requested", - "title": "Time Range" - }, - "tokens_charged": { - "default": 0, - "description": "Tokens charged for this job", - "title": "Tokens Charged", - "type": "integer" - } - }, - "required": [ - "job_id", - "query", - "page", - "safe", - "status", - "created_at" - ], - "title": "SearchJobDetailResponse", - "type": "object" - }, - "SearchJobsResponse": { - "properties": { - "jobs": { - "description": "Search jobs on this page", - "items": { - "$ref": "#/components/schemas/SearchListItemResponse" - }, - "title": "Jobs", - "type": "array" - }, - "page": { - "description": "Current page number", - "title": "Page", - "type": "integer" - }, - "page_count": { - "description": "Total number of pages available", - "title": "Page Count", - "type": "integer" + "description": "The discount as Google words it: \"66% off\"", + "title": "Discount" }, - "page_size": { - "description": "Number of jobs per page", - "title": "Page Size", - "type": "integer" - } - }, - "required": [ - "jobs", - "page", - "page_size", - "page_count" - ], - "title": "SearchJobsResponse", - "type": "object" - }, - "SearchListItemResponse": { - "properties": { - "block_reason": { + "domain": { "anyOf": [ { "type": "string" @@ -2660,41 +3614,33 @@ "type": "null" } ], - "description": "Upstream block classification for failed jobs", - "title": "Block Reason" + "description": "The store's own domain", + "title": "Domain" }, - "completed_at": { + "in_stock": { "anyOf": [ { - "format": "date-time", - "type": "string" + "type": "boolean" }, { "type": "null" } ], - "description": "When the search job finished", - "title": "Completed At" - }, - "created_at": { - "description": "When the search job was created", - "format": "date-time", - "title": "Created At", - "type": "string" + "description": "Whether the store has it, when the row says", + "title": "In Stock" }, - "duration_ms": { + "installment": { "anyOf": [ { - "type": "integer" + "$ref": "#/components/schemas/ShoppingInstallmentModel" }, { "type": "null" } ], - "description": "Execution time in milliseconds", - "title": "Duration Ms" + "description": "The price by the month, on an offer sold that way" }, - "error_code": { + "link": { "anyOf": [ { "type": "string" @@ -2703,65 +3649,22 @@ "type": "null" } ], - "description": "Machine-readable error code for failed jobs", - "title": "Error Code" - }, - "job_id": { - "description": "Unique job identifier", - "format": "uuid", - "title": "Job Id", - "type": "string" - }, - "query": { - "description": "Search query that was submitted", - "title": "Query", - "type": "string" - }, - "results_count": { - "default": 0, - "description": "Number of results returned", - "title": "Results Count", - "type": "integer" + "description": "The store's page for the product: its own address", + "title": "Link" }, - "status": { - "$ref": "#/components/schemas/JobStatus", - "description": "Job status" - } - }, - "required": [ - "job_id", - "query", - "status", - "created_at" - ], - "title": "SearchListItemResponse", - "type": "object" - }, - "SearchRequest": { - "properties": { - "engine": { + "more_stores_page": { "anyOf": [ { - "enum": [ - "brave", - "duckduckgo", - "naver" - ], - "type": "string" + "type": "integer" }, { "type": "null" } ], - "description": "Pin the search to one engine, with no fallback to any other. Omit to let the service rotate across its engines and fall back on failure, which is what most callers want. Pinning trades reliability for control: a single engine having a bad moment becomes your error instead of being routed around.", - "examples": [ - "brave", - "duckduckgo", - "naver" - ], - "title": "Search engine" + "description": "For a store behind the button, after which ask of \"More stores\" it came (1 first)", + "title": "More Stores Page" }, - "locale": { + "name": { "anyOf": [ { "type": "string" @@ -2770,113 +3673,114 @@ "type": "null" } ], - "description": "Locale tag: a language code ('en'), a language-region tag ('en-US'), or 'all'.", - "title": "Locale" + "description": "The store's name as Google gives it", + "title": "Name" }, - "page": { - "default": 1, - "description": "Result page to fetch. Without `engine`, 1 to 9. With `engine` set, the pinned engine's own limit applies instead: brave 9, duckduckgo 5, naver 9.", - "examples": [ - 1, - 2, - 9 + "original_price": { + "anyOf": [ + { + "type": "number" + }, + { + "type": "null" + } ], - "maximum": 9.0, - "minimum": 1.0, - "title": "Result page", - "type": "integer" + "description": "The price before a discount", + "title": "Original Price" }, - "query": { - "description": "Search query", - "maxLength": 1000, - "minLength": 1, - "title": "Query", - "type": "string" + "payment_methods": { + "description": "\"PayPal\", \"Google Pay\", \"Affirm\"", + "items": { + "type": "string" + }, + "title": "Payment Methods", + "type": "array" }, - "safe": { - "default": "off", - "description": "Safe-search filtering level. Accepted values: \"off\", \"moderate\", or \"strict\".", - "enum": [ - "off", - "moderate", - "strict" - ], - "examples": [ - "off", - "moderate", - "strict" - ], - "title": "Safe-search level", - "type": "string" + "position": { + "description": "1-based place in Google's list of the product's stores", + "title": "Position", + "type": "integer" }, - "time_range": { + "price": { "anyOf": [ { - "enum": [ - "day", - "week", - "month", - "year" - ], - "type": "string" + "type": "number" }, { "type": "null" } ], - "description": "Restrict results to a recency window. Accepted values: \"day\", \"week\", \"month\", or \"year\".", - "examples": [ - "day", - "week", - "month", - "year" - ], - "title": "Time range" - } - }, - "required": [ - "query" - ], - "title": "SearchRequest", - "type": "object" - }, - "SearchResponse": { - "properties": { - "attempts": { - "description": "Number of upstream attempts made", - "title": "Attempts", - "type": "integer" + "description": "The price; absent on an offer paid by the month", + "title": "Price" }, - "engine": { - "description": "Engine that actually served these results", - "title": "Engine", - "type": "string" + "promotion": { + "anyOf": [ + { + "$ref": "#/components/schemas/ShoppingPromotionModel" + }, + { + "type": "null" + } + ] + }, + "returns": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "description": "\"30-day returns\", \"Final sale\"", + "title": "Returns" }, - "job_id": { - "description": "Unique job identifier for this search", - "format": "uuid", - "title": "Job Id", + "shown": { + "description": "\"page\": the product's page shows it at once; \"more_stores\": it is behind the button", + "enum": [ + "page", + "more_stores" + ], + "title": "Shown", "type": "string" }, - "page": { - "description": "Result page that was returned", - "title": "Page", - "type": "integer" + "store_rating": { + "anyOf": [ + { + "type": "number" + }, + { + "type": "null" + } + ], + "description": "The store's rating with Google, out of 5", + "title": "Store Rating" }, - "query": { - "description": "Search query that was submitted", - "title": "Query", - "type": "string" + "store_reviews": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "description": "How many reviews that rating stands on", + "title": "Store Reviews" }, - "results": { - "description": "Search results", - "items": { - "$ref": "#/components/schemas/SearchHitModel" - }, - "title": "Results", - "type": "array" + "tag": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "description": "Google's badge on the row: \"Best price\"", + "title": "Tag" }, - "spelling_correction": { + "title": { "anyOf": [ { "type": "string" @@ -2885,28 +3789,27 @@ "type": "null" } ], - "description": "Spelling correction applied to the query", - "title": "Spelling Correction" + "description": "The store's own title for the product", + "title": "Title" }, - "suggestions": { - "description": "Query suggestions returned by the engine", - "items": { - "type": "string" - }, - "title": "Suggestions", - "type": "array" + "total_price": { + "anyOf": [ + { + "type": "number" + }, + { + "type": "null" + } + ], + "description": "The price with delivery, when both are known", + "title": "Total Price" } }, "required": [ - "job_id", - "engine", - "query", - "page", - "attempts", - "results", - "suggestions" + "position", + "shown" ], - "title": "SearchResponse", + "title": "ShoppingSellerModel", "type": "object" }, "StatisticsResponse": { @@ -3376,6 +4279,26 @@ "401": { "description": "Unauthorized" }, + "402": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + }, + "description": "No active subscription, insufficient balance or the key's spend cap reached; billing's code in details.reason" + }, + "403": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + }, + "description": "The key lacks the scope or the account is restricted (FORBIDDEN); billing's code in details.reason" + }, "422": { "description": "Validation error" }, @@ -3660,6 +4583,108 @@ ] } }, + "/v1/batch/{job_id}/download": { + "get": { + "description": "A temporary link to a zip of a finished batch: one file per successful URL in the batch's formats and a manifest.json of the URLs without a file. Asking again returns a new link to the same archive. While the zip is still being built the answer is 202 with a Retry-After header. Not charged.", + "operationId": "download_batch_results_v1_batch__job_id__download_get", + "parameters": [ + { + "in": "path", + "name": "job_id", + "required": true, + "schema": { + "format": "uuid", + "title": "Job Id", + "type": "string" + } + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/BatchDownloadResponse" + } + } + }, + "description": "Successful Response" + }, + "202": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + }, + "description": "Archive still being built; retry after Retry-After seconds" + }, + "401": { + "description": "Unauthorized" + }, + "404": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + }, + "description": "Job not found" + }, + "409": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + }, + "description": "Job is still running" + }, + "410": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + }, + "description": "Results are no longer kept" + }, + "422": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HTTPValidationError" + } + } + }, + "description": "Validation Error" + }, + "503": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + }, + "description": "Archive storage unavailable" + } + }, + "security": [ + { + "ApiKeyAuth": [] + } + ], + "summary": "Download all results of a batch as one zip", + "tags": [ + "Batch" + ] + } + }, "/v1/crawl": { "post": { "description": "Crawl a website starting from a seed URL up to a given depth and page limit", @@ -3689,7 +4714,24 @@ "description": "Unauthorized" }, "402": { - "description": "No active subscription, or insufficient balance" + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + }, + "description": "No active subscription, insufficient balance or the key's spend cap reached; billing's code in details.reason" + }, + "403": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + }, + "description": "The seed URL is a Google search results page, which Google Search Light serves (GOOGLE_SEARCH_MOVED); not retryable and not charged. Or billing refused: The key lacks the scope or the account is restricted (FORBIDDEN); billing's code in details.reason" }, "422": { "description": "Validation error" @@ -3717,24 +4759,6 @@ "description": "List crawl jobs for the authenticated user with optional filtering and pagination", "operationId": "list_crawl_jobs_v1_crawl_jobs_get", "parameters": [ - { - "description": "Filter by seed URL (partial match)", - "in": "query", - "name": "url", - "required": false, - "schema": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "description": "Filter by seed URL (partial match)", - "title": "Url" - } - }, { "description": "Filter by job status", "in": "query", @@ -3830,6 +4854,16 @@ }, "description": "Successful Response" }, + "400": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + }, + "description": "Unsupported filter" + }, "401": { "description": "Unauthorized" }, @@ -4056,7 +5090,17 @@ } } }, - "description": "Payment required" + "description": "No active subscription, insufficient balance or the key's spend cap reached; billing's code in details.reason" + }, + "403": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ExtractionErrorResponse" + } + } + }, + "description": "Target blocked by the compliance blocklist (TARGET_BLOCKED), or a Google search results page, which Google Search Light serves (GOOGLE_SEARCH_MOVED); not retryable and not charged. Or billing refused, in the flat error body: The key lacks the scope or the account is restricted (FORBIDDEN); billing's code in details.reason" }, "422": { "content": { @@ -4112,11 +5156,11 @@ }, "/v1/extract/jobs": { "get": { - "description": "List and filter extraction jobs by job ID, URL, status, output format, and date range", + "description": "List and filter extraction jobs by full job ID (exact match), status, output format, and date range", "operationId": "list_jobs_v1_extract_jobs_get", "parameters": [ { - "description": "Filter by job ID", + "description": "Filter by full job ID (exact match, UUID)", "in": "query", "name": "job_id", "required": false, @@ -4129,28 +5173,10 @@ "type": "null" } ], - "description": "Filter by job ID", + "description": "Filter by full job ID (exact match, UUID)", "title": "Job Id" } }, - { - "description": "Filter by target URL", - "in": "query", - "name": "url", - "required": false, - "schema": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "description": "Filter by target URL", - "title": "Url" - } - }, { "description": "Filter by job status", "in": "query", @@ -4257,11 +5283,21 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/JobCollectionResponse" + "$ref": "#/components/schemas/JobCollectionResponse" + } + } + }, + "description": "Job list retrieved" + }, + "400": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" } } }, - "description": "Job list retrieved" + "description": "Unsupported filter or invalid job ID" }, "401": { "content": { @@ -4373,6 +5409,240 @@ ] } }, + "/v1/google/search/light": { + "post": { + "description": "Organic Google results, in one shape for every request: `{job_id, query, pages_requested, pages_returned, pages_stopped, pages: [...]}`. `pages` asks for pages 1 to N in one request, fetched through one Google session and exit IP and billed per page returned; without it the answer holds one page. `format` chooses what each page carries: the parsed results (json), the page as Google sent it (html), or both. `ai_overview` adds Google's AI Overview on page 1.", + "operationId": "google_search_light_v1_google_search_light_post", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GoogleSearchLightRequest" + } + } + }, + "required": true + }, + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GoogleSearchLightResponse" + } + } + }, + "description": "The pages, page 1 first. \"html\" and \"both\" come gzip-compressed for a client that accepts it." + }, + "401": { + "description": "Unauthorized" + }, + "402": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + }, + "description": "No active subscription, or insufficient token balance" + }, + "408": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + }, + "description": "Request timed out" + }, + "422": { + "content": { + "application/json": { + "examples": { + "no_results": { + "summary": "Google returned no results", + "value": { + "code": "NO_RESULTS", + "correlation_id": "6f1d2a9c-3b7e-4c5a-9e21-0d8f4b7a1c33", + "details": { + "attempts": 1, + "reason": "empty" + }, + "message": "search blocked (empty) after 1 attempts", + "retryable": false + } + }, + "upstream_blocked": { + "summary": "Google would not serve the query", + "value": { + "code": "UPSTREAM_BLOCKED", + "correlation_id": "0b8e7f42-91c3-4d6a-b5e0-2a7c9d13f846", + "details": { + "attempts": 3, + "reason": "captcha" + }, + "message": "search blocked (captcha) after 3 attempts", + "retryable": true + } + } + }, + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + }, + "description": "No page: Google returned no results (`NO_RESULTS`, not retryable: asking again changes nothing), or would not serve the query (`UPSTREAM_BLOCKED`, retryable: the same query often passes on another exit). Neither is billed. A request body the API cannot read is also a 422, with a `detail` list instead of `code`." + }, + "429": { + "description": "Request throttled" + }, + "500": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + }, + "description": "Internal server error" + }, + "502": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + }, + "description": "Upstream unreachable" + }, + "503": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + }, + "description": "Google search is not available on this deployment" + } + }, + "security": [ + { + "ApiKeyAuth": [] + } + ], + "summary": "Google search, light", + "tags": [ + "Google" + ] + } + }, + "/v1/google/shopping/product": { + "post": { + "description": "A Google Shopping product by its catalog id, and the stores that sell it with their prices: the stores the product's page shows, and those behind its \"More stores\" button, ten at each of `more_stores` asks. As a US buyer sees it, in English. One request is one product, whatever the number of stores.", + "operationId": "google_shopping_product_v1_google_shopping_product_post", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GoogleShoppingProductRequest" + } + } + }, + "required": true + }, + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GoogleShoppingProductResponse" + } + } + }, + "description": "Successful Response" + }, + "401": { + "description": "Unauthorized" + }, + "402": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + }, + "description": "No active subscription, or insufficient balance" + }, + "408": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + }, + "description": "Request timed out" + }, + "422": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + }, + "description": "Google has no such product, or would not serve it" + }, + "429": { + "description": "Request throttled" + }, + "500": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + }, + "description": "Internal server error" + }, + "502": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + }, + "description": "Upstream unreachable" + }, + "503": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + }, + "description": "Google Shopping is not available on this deployment" + } + }, + "security": [ + { + "ApiKeyAuth": [] + } + ], + "summary": "Google Shopping, a product and its sellers", + "tags": [ + "Google" + ] + } + }, "/v1/map": { "post": { "description": "Returns the list of URLs found under the given base URL by combining sitemap parsing with HTML link extraction from the seed page. By default discovery is scoped to the exact seed host (a leading `www.` is treated as equivalent) and, when the URL includes a path, to URLs under that path; sibling subdomains and outbound links are excluded. Set `include_subdomains=true` to widen the scope to the whole registrable domain and probe common subdomains (docs, blog, help, support). The optional `search` parameter filters the discovered URLs by case-insensitive substring match — it does NOT query a search engine.", @@ -4426,7 +5696,17 @@ } } }, - "description": "No active subscription, or insufficient token balance" + "description": "No active subscription, insufficient balance or the key's spend cap reached; billing's code in details.reason" + }, + "403": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + }, + "description": "Target blocked by the compliance blocklist (TARGET_BLOCKED); not retryable and not charged. Or billing refused: The key lacks the scope or the account is restricted (FORBIDDEN); billing's code in details.reason" }, "408": { "content": { @@ -4495,24 +5775,6 @@ "description": "List map jobs for the authenticated user with optional filtering and pagination", "operationId": "list_map_jobs_v1_map_jobs_get", "parameters": [ - { - "description": "Filter by base URL (partial match)", - "in": "query", - "name": "url", - "required": false, - "schema": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "description": "Filter by base URL (partial match)", - "title": "Url" - } - }, { "description": "Filter by job status", "in": "query", @@ -4608,6 +5870,16 @@ }, "description": "Successful Response" }, + "400": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + }, + "description": "Unsupported filter" + }, "401": { "content": { "application/json": { @@ -4724,7 +5996,7 @@ } } }, - "description": "Successful Response" + "description": "Search results. `results` is empty when the engine answered and found nothing; such a search is not charged." }, "401": { "description": "Unauthorized" @@ -4737,7 +6009,17 @@ } } }, - "description": "No active subscription, or insufficient token balance" + "description": "No active subscription, insufficient balance or the key's spend cap reached; billing's code in details.reason" + }, + "403": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + }, + "description": "The key lacks the scope or the account is restricted (FORBIDDEN); billing's code in details.reason" }, "408": { "content": { @@ -4809,24 +6091,6 @@ "description": "List search jobs for the authenticated user with optional filtering and pagination", "operationId": "list_search_jobs_v1_search_jobs_get", "parameters": [ - { - "description": "Filter by search query (partial match)", - "in": "query", - "name": "query", - "required": false, - "schema": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "description": "Filter by search query (partial match)", - "title": "Query" - } - }, { "description": "Filter by job status", "in": "query", @@ -4922,6 +6186,16 @@ }, "description": "Successful Response" }, + "400": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + }, + "description": "Unsupported filter" + }, "401": { "content": { "application/json": { @@ -5022,7 +6296,7 @@ "operationId": "get_statistics_v1_statistics_get", "parameters": [ { - "description": "Filter by start date (defaults to 30 days ago)", + "description": "Filter by start date (defaults to 30 days ago). The window covers at most 366 days, counted back from the end of `end_date` (a date-only `end_date` includes its whole day); an older start is moved up", "in": "query", "name": "start_date", "required": false, @@ -5036,12 +6310,12 @@ "type": "null" } ], - "description": "Filter by start date (defaults to 30 days ago)", + "description": "Filter by start date (defaults to 30 days ago). The window covers at most 366 days, counted back from the end of `end_date` (a date-only `end_date` includes its whole day); an older start is moved up", "title": "Start Date" } }, { - "description": "Filter by end date (defaults to now)", + "description": "Filter by end date (defaults to now); a later end date is moved back to now", "in": "query", "name": "end_date", "required": false, @@ -5055,7 +6329,7 @@ "type": "null" } ], - "description": "Filter by end date (defaults to now)", + "description": "Filter by end date (defaults to now); a later end date is moved back to now", "title": "End Date" } } From 05d6f6cb218bf2b76e3c5dde7e8adc02390a270d Mon Sep 17 00:00:00 2001 From: Ivan Antsileuski Date: Tue, 24 Nov 2026 15:59:19 +0300 Subject: [PATCH 2/2] Update tests for the synced API spec The API added the TARGET_BLOCKED and GOOGLE_SEARCH_MOVED error codes and dropped the `url` filter on the extract job list, which it now rejects with 400. The job-list tests no longer pass `url`, and a new test pins that the client refuses it. Co-Authored-By: Claude Opus 5.5 --- tests/test_error_models.py | 2 ++ tests/test_extraction_api.py | 10 +++++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/tests/test_error_models.py b/tests/test_error_models.py index 927ce14..b6941d9 100644 --- a/tests/test_error_models.py +++ b/tests/test_error_models.py @@ -45,6 +45,8 @@ def test_extraction_error_code_all_values(): "INTERNAL_ERROR", "PROXY_ERROR", "CANCELLED", + "TARGET_BLOCKED", + "GOOGLE_SEARCH_MOVED", } actual = {member.value for member in ExtractionErrorCode} assert actual == expected diff --git a/tests/test_extraction_api.py b/tests/test_extraction_api.py index 4d24618..4946aab 100644 --- a/tests/test_extraction_api.py +++ b/tests/test_extraction_api.py @@ -2,6 +2,7 @@ from unittest.mock import patch import pytest +from pydantic import ValidationError from geonode_scraper_sdk.api.extraction_api import ExtractionApi from geonode_scraper_sdk.models.error_response import ErrorResponse @@ -262,7 +263,6 @@ def test_list_jobs(extraction_api, mock_api_client, make_mock_http_response): ("kwargs", "expected_query"), [ ({"job_id": "test-job-uuid"}, {"job_id": "test-job-uuid"}), - ({"url": "https://example.com/path?q=1"}, {"url": "https://example.com/path?q=1"}), ({"status": JobStatus.COMPLETED}, {"status": "completed"}), ({"output": OutputFormat.HTML}, {"output": "html"}), ( @@ -309,7 +309,6 @@ def test_list_jobs_serializes_all_filters_together( with patch.object(mock_api_client.rest_client.pool_manager, "request", return_value=mock_resp) as mock_req: extraction_api.list_jobs_v1_extract_jobs_get( job_id="test-job-uuid", - url="https://example.com/path?q=1", status=JobStatus.COMPLETED, output=OutputFormat.MARKDOWN, start_date=start, @@ -321,7 +320,6 @@ def test_list_jobs_serializes_all_filters_together( query = get_request_details(mock_req)["query"] assert query == { "job_id": "test-job-uuid", - "url": "https://example.com/path?q=1", "status": "completed", "output": "markdown", "start_date": start.strftime(mock_api_client.configuration.datetime_format), @@ -331,6 +329,12 @@ def test_list_jobs_serializes_all_filters_together( } +def test_list_jobs_no_longer_accepts_a_url_filter(extraction_api): + # The API rejects `url` on job lists with 400, so the client refuses it before sending anything. + with pytest.raises(ValidationError): + extraction_api.list_jobs_v1_extract_jobs_get(url="https://example.com/path?q=1") + + @pytest.mark.parametrize( ("status", "fixture_name", "code", "retryable"), [