Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions geonode_scraper_sdk/api/batch_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions geonode_scraper_sdk/api/crawl_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion geonode_scraper_sdk/models/batch_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]

Expand Down
9 changes: 8 additions & 1 deletion geonode_scraper_sdk/models/batch_status_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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
Expand All @@ -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
})
Expand Down
2 changes: 1 addition & 1 deletion geonode_scraper_sdk/models/crawl_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
9 changes: 8 additions & 1 deletion geonode_scraper_sdk/models/crawl_status_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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
Expand All @@ -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")
Expand Down
32 changes: 28 additions & 4 deletions openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
Expand Down Expand Up @@ -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"
},
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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"
},
Expand Down Expand Up @@ -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": {
Expand Down Expand Up @@ -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": {
Expand Down
Loading