From 442fb2dbdd2be2a8ade78e045877482007031000 Mon Sep 17 00:00:00 2001 From: "geonode-internal-integrations-bot[bot]" <360627573+geonode-internal-integrations-bot[bot]@users.noreply.github.com> Date: Sat, 28 Nov 2026 02:25:59 +0000 Subject: [PATCH] Sync API spec with production --- CHANGELOG.md | 2 ++ geonode_scraper_sdk/api/batch_api.py | 6 ++-- geonode_scraper_sdk/api/crawl_api.py | 6 ++-- geonode_scraper_sdk/models/batch_request.py | 2 +- .../models/batch_status_response.py | 9 +++++- geonode_scraper_sdk/models/crawl_request.py | 2 +- .../models/crawl_status_response.py | 9 +++++- openapi.json | 32 ++++++++++++++++--- 8 files changed, 54 insertions(+), 14 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 37c14a2..c811381 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,8 @@ The format is inspired by Keep a Changelog. ## [Unreleased] +- Synced with the production API spec. + - New model fields: `BatchStatusResponse.stop_reason`, `CrawlStatusResponse.stop_reason`. - Removed the outdated generated API and model pages from `docs/`; they predate several endpoints and were linked from nowhere. `docs/guide.md` is the reference. ## [0.7.0] - 2026-11-26 diff --git a/geonode_scraper_sdk/api/batch_api.py b/geonode_scraper_sdk/api/batch_api.py index 0110e8e..b87172e 100644 --- a/geonode_scraper_sdk/api/batch_api.py +++ b/geonode_scraper_sdk/api/batch_api.py @@ -337,7 +337,7 @@ def create_batch_v1_batch_post( ) -> BatchAccepted: """Start a batch extraction job - Queue a batch of URLs for asynchronous extraction + Queue a batch of URLs for asynchronous extraction. A job stops starting new URLs 24 hours after its first reservation: URLs already running finish, the rest are cancelled and not charged, and the job completes with stop_reason `time_limit`. :param batch_request: (required) :type batch_request: BatchRequest @@ -410,7 +410,7 @@ def create_batch_v1_batch_post_with_http_info( ) -> ApiResponse[BatchAccepted]: """Start a batch extraction job - Queue a batch of URLs for asynchronous extraction + Queue a batch of URLs for asynchronous extraction. A job stops starting new URLs 24 hours after its first reservation: URLs already running finish, the rest are cancelled and not charged, and the job completes with stop_reason `time_limit`. :param batch_request: (required) :type batch_request: BatchRequest @@ -483,7 +483,7 @@ def create_batch_v1_batch_post_without_preload_content( ) -> RESTResponseType: """Start a batch extraction job - Queue a batch of URLs for asynchronous extraction + Queue a batch of URLs for asynchronous extraction. A job stops starting new URLs 24 hours after its first reservation: URLs already running finish, the rest are cancelled and not charged, and the job completes with stop_reason `time_limit`. :param batch_request: (required) :type batch_request: BatchRequest diff --git a/geonode_scraper_sdk/api/crawl_api.py b/geonode_scraper_sdk/api/crawl_api.py index 476014b..8306e30 100644 --- a/geonode_scraper_sdk/api/crawl_api.py +++ b/geonode_scraper_sdk/api/crawl_api.py @@ -336,7 +336,7 @@ def create_crawl_v1_crawl_post( ) -> CrawlAccepted: """Start a crawl job - Crawl a website starting from a seed URL up to a given depth and page limit + Crawl a website starting from a seed URL up to a given depth and page limit. A job stops starting new pages 24 hours after its first reservation: pages already running finish, the rest are cancelled and not charged, and the job completes with stop_reason `time_limit`. :param crawl_request: (required) :type crawl_request: CrawlRequest @@ -409,7 +409,7 @@ def create_crawl_v1_crawl_post_with_http_info( ) -> ApiResponse[CrawlAccepted]: """Start a crawl job - Crawl a website starting from a seed URL up to a given depth and page limit + Crawl a website starting from a seed URL up to a given depth and page limit. A job stops starting new pages 24 hours after its first reservation: pages already running finish, the rest are cancelled and not charged, and the job completes with stop_reason `time_limit`. :param crawl_request: (required) :type crawl_request: CrawlRequest @@ -482,7 +482,7 @@ def create_crawl_v1_crawl_post_without_preload_content( ) -> RESTResponseType: """Start a crawl job - Crawl a website starting from a seed URL up to a given depth and page limit + Crawl a website starting from a seed URL up to a given depth and page limit. A job stops starting new pages 24 hours after its first reservation: pages already running finish, the rest are cancelled and not charged, and the job completes with stop_reason `time_limit`. :param crawl_request: (required) :type crawl_request: CrawlRequest diff --git a/geonode_scraper_sdk/models/batch_request.py b/geonode_scraper_sdk/models/batch_request.py index 5d82f02..d4d12b5 100644 --- a/geonode_scraper_sdk/models/batch_request.py +++ b/geonode_scraper_sdk/models/batch_request.py @@ -36,7 +36,7 @@ class BatchRequest(BaseModel): ignore_invalid_urls: Optional[StrictBool] = Field(default=True, description="If true, invalid URLs are skipped and returned in invalid_urls instead of failing the request") proxy: Optional[ProxySettings] = Field(default=None, description="Proxy configuration") render_js: Optional[StrictBool] = Field(default=False, description="If true, uses a headless browser to render the page for every batch item") - urls: Annotated[List[StrictStr], Field(min_length=1, max_length=1000)] = Field(description="URLs to extract in one batch") + urls: Annotated[List[StrictStr], Field(min_length=1, max_length=1000)] = Field(description="URLs to extract in one batch. A job stops starting new URLs 24 hours after its first reservation: URLs already running finish, the rest are cancelled and not charged, and the job completes with stop_reason `time_limit`.") wait_config: Optional[WaitConfig] = None __properties: ClassVar[List[str]] = ["formats", "headers", "ignore_invalid_urls", "proxy", "render_js", "urls", "wait_config"] diff --git a/geonode_scraper_sdk/models/batch_status_response.py b/geonode_scraper_sdk/models/batch_status_response.py index cc87a71..3cf1b0b 100644 --- a/geonode_scraper_sdk/models/batch_status_response.py +++ b/geonode_scraper_sdk/models/batch_status_response.py @@ -44,9 +44,10 @@ class BatchStatusResponse(BaseModel): pending_urls: Optional[StrictInt] = 0 results: Optional[List[BatchResultItem]] = None status: JobStatus + stop_reason: Optional[StrictStr] = None token_summary: BatchTokenSummary total_urls: Optional[StrictInt] = Field(default=0, description="Number of accepted URLs in the batch") - __properties: ClassVar[List[str]] = ["batch_config", "cancelled_urls", "completed_at", "completed_urls", "created_at", "failed_urls", "invalid_urls", "job_id", "pending_urls", "results", "status", "token_summary", "total_urls"] + __properties: ClassVar[List[str]] = ["batch_config", "cancelled_urls", "completed_at", "completed_urls", "created_at", "failed_urls", "invalid_urls", "job_id", "pending_urls", "results", "status", "stop_reason", "token_summary", "total_urls"] model_config = ConfigDict( validate_by_name=True, @@ -115,6 +116,11 @@ def to_dict(self) -> Dict[str, Any]: if self.results is None and "results" in self.model_fields_set: _dict['results'] = None + # set to None if stop_reason (nullable) is None + # and model_fields_set contains the field + if self.stop_reason is None and "stop_reason" in self.model_fields_set: + _dict['stop_reason'] = None + return _dict @classmethod @@ -138,6 +144,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "pending_urls": obj.get("pending_urls") if obj.get("pending_urls") is not None else 0, "results": [BatchResultItem.from_dict(_item) for _item in obj["results"]] if obj.get("results") is not None else None, "status": obj.get("status"), + "stop_reason": obj.get("stop_reason"), "token_summary": BatchTokenSummary.from_dict(obj["token_summary"]) if obj.get("token_summary") is not None else None, "total_urls": obj.get("total_urls") if obj.get("total_urls") is not None else 0 }) diff --git a/geonode_scraper_sdk/models/crawl_request.py b/geonode_scraper_sdk/models/crawl_request.py index 14bb5af..1ba3796 100644 --- a/geonode_scraper_sdk/models/crawl_request.py +++ b/geonode_scraper_sdk/models/crawl_request.py @@ -34,7 +34,7 @@ class CrawlRequest(BaseModel): depth: Optional[Annotated[int, Field(le=10, strict=True, ge=1)]] = Field(default=2, description="Maximum BFS depth from the seed URL (1 = seed only)") formats: Optional[List[OutputFormat]] = Field(default=None, description="Output formats to extract per page") include_subdomains: Optional[StrictBool] = Field(default=False, description="When same_domain_only is true, also include subdomains of the seed domain") - limit: Optional[Annotated[int, Field(le=10000, strict=True, ge=1)]] = Field(default=50, description="Maximum number of pages to crawl") + limit: Optional[Annotated[int, Field(le=10000, strict=True, ge=1)]] = Field(default=50, description="Maximum number of pages to crawl. A job stops starting new pages 24 hours after its first reservation: pages already running finish, the rest are cancelled and not charged, and the job completes with stop_reason `time_limit`.") proxy: Optional[ProxySettings] = None render_js: Optional[StrictBool] = Field(default=False, description="Use a headless browser to render each page (slower, handles JS-heavy sites)") same_domain_only: Optional[StrictBool] = Field(default=True, description="Only follow links that stay on the same domain as the seed URL") diff --git a/geonode_scraper_sdk/models/crawl_status_response.py b/geonode_scraper_sdk/models/crawl_status_response.py index 3959212..4277630 100644 --- a/geonode_scraper_sdk/models/crawl_status_response.py +++ b/geonode_scraper_sdk/models/crawl_status_response.py @@ -42,10 +42,11 @@ class CrawlStatusResponse(BaseModel): job_id: UUID results: Optional[List[CrawlPageItem]] = None status: JobStatus + stop_reason: Optional[StrictStr] = None token_summary: CrawlTokenSummary total_pages: Optional[StrictInt] = Field(default=0, description="Total crawl pages discovered so far, not pagination page count") url: StrictStr - __properties: ClassVar[List[str]] = ["cancelled_pages", "completed_at", "completed_pages", "crawl_config", "created_at", "failed_pages", "job_id", "results", "status", "token_summary", "total_pages", "url"] + __properties: ClassVar[List[str]] = ["cancelled_pages", "completed_at", "completed_pages", "crawl_config", "created_at", "failed_pages", "job_id", "results", "status", "stop_reason", "token_summary", "total_pages", "url"] model_config = ConfigDict( validate_by_name=True, @@ -114,6 +115,11 @@ def to_dict(self) -> Dict[str, Any]: if self.results is None and "results" in self.model_fields_set: _dict['results'] = None + # set to None if stop_reason (nullable) is None + # and model_fields_set contains the field + if self.stop_reason is None and "stop_reason" in self.model_fields_set: + _dict['stop_reason'] = None + return _dict @classmethod @@ -135,6 +141,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "job_id": obj.get("job_id"), "results": [CrawlPageItem.from_dict(_item) for _item in obj["results"]] if obj.get("results") is not None else None, "status": obj.get("status"), + "stop_reason": obj.get("stop_reason"), "token_summary": CrawlTokenSummary.from_dict(obj["token_summary"]) if obj.get("token_summary") is not None else None, "total_pages": obj.get("total_pages") if obj.get("total_pages") is not None else 0, "url": obj.get("url") diff --git a/openapi.json b/openapi.json index e160fc7..4862942 100644 --- a/openapi.json +++ b/openapi.json @@ -379,7 +379,7 @@ "type": "boolean" }, "urls": { - "description": "URLs to extract in one batch", + "description": "URLs to extract in one batch. A job stops starting new URLs 24 hours after its first reservation: URLs already running finish, the rest are cancelled and not charged, and the job completes with stop_reason `time_limit`.", "items": { "type": "string" }, @@ -552,6 +552,18 @@ "status": { "$ref": "#/components/schemas/JobStatus" }, + "stop_reason": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "description": "Why a completed job was cut short, otherwise null. The only value today is `time_limit`: the job reached its run time limit and did not start the rest of its work.", + "title": "Stop Reason" + }, "token_summary": { "$ref": "#/components/schemas/BatchTokenSummary" }, @@ -1011,7 +1023,7 @@ }, "limit": { "default": 50, - "description": "Maximum number of pages to crawl", + "description": "Maximum number of pages to crawl. A job stops starting new pages 24 hours after its first reservation: pages already running finish, the rest are cancelled and not charged, and the job completes with stop_reason `time_limit`.", "maximum": 10000.0, "minimum": 1.0, "title": "Limit", @@ -1138,6 +1150,18 @@ "status": { "$ref": "#/components/schemas/JobStatus" }, + "stop_reason": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "description": "Why a completed job was cut short, otherwise null. The only value today is `time_limit`: the job reached its run time limit and did not start the rest of its work.", + "title": "Stop Reason" + }, "token_summary": { "$ref": "#/components/schemas/CrawlTokenSummary" }, @@ -4253,7 +4277,7 @@ }, "/v1/batch": { "post": { - "description": "Queue a batch of URLs for asynchronous extraction", + "description": "Queue a batch of URLs for asynchronous extraction. A job stops starting new URLs 24 hours after its first reservation: URLs already running finish, the rest are cancelled and not charged, and the job completes with stop_reason `time_limit`.", "operationId": "create_batch_v1_batch_post", "requestBody": { "content": { @@ -4687,7 +4711,7 @@ }, "/v1/crawl": { "post": { - "description": "Crawl a website starting from a seed URL up to a given depth and page limit", + "description": "Crawl a website starting from a seed URL up to a given depth and page limit. A job stops starting new pages 24 hours after its first reservation: pages already running finish, the rest are cancelled and not charged, and the job completes with stop_reason `time_limit`.", "operationId": "create_crawl_v1_crawl_post", "requestBody": { "content": {