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: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "2.6.0"
".": "2.7.0"
}
4 changes: 2 additions & 2 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
configured_endpoints: 37
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-960cb623c7ec84bf4dc0f5945cbc19eec9cca48271071f400d96066eaa55dbd6.yml
openapi_spec_hash: 84fd39e3f4dc964bf0c32d4e95da1b34
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-758c3a2fbd5b7be61c8e6e0ad2e6a5ec30695747bb675960d888c497647d13d7.yml
openapi_spec_hash: 00002d90bde02f67e174368ae470c597
config_hash: 2bea1743c84d63bd61f8501a6ea63065
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# Changelog

## 2.7.0 (2026-08-01)

Full Changelog: [v2.6.0...v2.7.0](https://github.com/context-dot-dev/context-python-sdk/compare/v2.6.0...v2.7.0)

### Features

* **api:** api update ([da261be](https://github.com/context-dot-dev/context-python-sdk/commit/da261be4676883e2a8e85ca0b4b7be887a24e85b))
* **api:** api update ([3688eab](https://github.com/context-dot-dev/context-python-sdk/commit/3688eab17dcc2546c3e9c7249d15be912354012c))
* **api:** api update ([63b8964](https://github.com/context-dot-dev/context-python-sdk/commit/63b89645bfe4a82faeee952478ff7fe8f33e1c59))

## 2.6.0 (2026-07-31)

Full Changelog: [v2.5.0...v2.6.0](https://github.com/context-dot-dev/context-python-sdk/compare/v2.5.0...v2.6.0)
Expand Down
6 changes: 4 additions & 2 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,10 @@ Types:

```python
from context.dev.types import (
ErrorCount,
Error,
PageErrorCount,
Failure,
CrawlControls,
Intake,
BatchRetrieveResponse,
BatchListResponse,
BatchCancelResponse,
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "context.dev"
version = "2.6.0"
version = "2.7.0"
description = "The official Python library for the context.dev API"
dynamic = ["readme"]
license = "Apache-2.0"
Expand Down
2 changes: 1 addition & 1 deletion src/context/dev/_version.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

__title__ = "context.dev"
__version__ = "2.6.0" # x-release-please-version
__version__ = "2.7.0" # x-release-please-version
24 changes: 8 additions & 16 deletions src/context/dev/resources/batch.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,8 @@ def retrieve(
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> BatchRetrieveResponse:
"""Check progress and get download links when the batch finishes.

Also returns the
rejected-URL list and webhook signing secret from submission, so nothing is lost
if the submit response was dropped.
"""
Check progress, and get download links once the batch finishes.

Args:
batch_id: ID of the batch to retrieve or cancel.
Expand Down Expand Up @@ -202,9 +199,8 @@ def get_results(
timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> BatchGetResultsResponse:
"""
Page through the result records of a finished batch as JSON, in the same order
as the downloadable result files. Use this instead of downloading and parsing
the NDJSON files yourself.
Page through a finished batch's results as JSON instead of downloading the
NDJSON files.

Args:
batch_id: ID of the batch to retrieve or cancel.
Expand Down Expand Up @@ -323,11 +319,8 @@ async def retrieve(
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> BatchRetrieveResponse:
"""Check progress and get download links when the batch finishes.

Also returns the
rejected-URL list and webhook signing secret from submission, so nothing is lost
if the submit response was dropped.
"""
Check progress, and get download links once the batch finishes.

Args:
batch_id: ID of the batch to retrieve or cancel.
Expand Down Expand Up @@ -467,9 +460,8 @@ async def get_results(
timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> BatchGetResultsResponse:
"""
Page through the result records of a finished batch as JSON, in the same order
as the downloadable result files. Use this instead of downloading and parsing
the NDJSON files yourself.
Page through a finished batch's results as JSON instead of downloading the
NDJSON files.

Args:
batch_id: ID of the batch to retrieve or cancel.
Expand Down
40 changes: 16 additions & 24 deletions src/context/dev/resources/web.py
Original file line number Diff line number Diff line change
Expand Up @@ -620,9 +620,8 @@ def screenshot(
color_scheme: Optional parameter to choose the site's visual theme in the screenshot. Use
'light' or 'dark' when the site offers both appearances.

country: Two-letter ISO 3166-1 alpha-2 country code identifying a supported Context.dev
residential proxy exit location. Must be one of Context.dev's supported
countries. When provided, Context.dev fetches the target page from that country.
country: Fetch the target page through a residential proxy in this country (ISO 3166-1
alpha-2).

direct_url: A specific URL to screenshot directly, bypassing domain resolution (e.g.,
'https://example.com/pricing'). When provided, the screenshot is taken of this
Expand Down Expand Up @@ -1280,9 +1279,8 @@ def web_crawl_md(
Args:
url: The starting URL for the crawl (must include http:// or https:// protocol)

country: Two-letter ISO 3166-1 alpha-2 country code identifying a supported Context.dev
residential proxy exit location. Must be one of Context.dev's supported
countries. When provided, Context.dev fetches the target page from that country.
country: Fetch the target page through a residential proxy in this country (ISO 3166-1
alpha-2).

exclude_selectors: CSS selectors to remove before each crawled page is converted to Markdown.
Applied after includeSelectors. Exclusion takes precedence: an element matching
Expand Down Expand Up @@ -1630,9 +1628,8 @@ def web_scrape_html(
content is captured. Requires a paid plan. Send a JSON array in the query
parameter. Maximum: 5 actions.

country: Two-letter ISO 3166-1 alpha-2 country code identifying a supported Context.dev
residential proxy exit location. Must be one of Context.dev's supported
countries. When provided, Context.dev fetches the target page from that country.
country: Fetch the target page through a residential proxy in this country (ISO 3166-1
alpha-2).

exclude_selectors: CSS selectors to remove from the result. Applied after includeSelectors.
Exclusion takes precedence: an element matching both is removed. Examples:
Expand Down Expand Up @@ -2071,9 +2068,8 @@ def web_scrape_md(
content is captured. Requires a paid plan. Send a JSON array in the query
parameter. Maximum: 5 actions.

country: Two-letter ISO 3166-1 alpha-2 country code identifying a supported Context.dev
residential proxy exit location. Must be one of Context.dev's supported
countries. When provided, Context.dev fetches the target page from that country.
country: Fetch the target page through a residential proxy in this country (ISO 3166-1
alpha-2).

exclude_selectors: CSS selectors to remove before conversion to Markdown. Applied after
includeSelectors. Exclusion takes precedence: an element matching both is
Expand Down Expand Up @@ -2824,9 +2820,8 @@ async def screenshot(
color_scheme: Optional parameter to choose the site's visual theme in the screenshot. Use
'light' or 'dark' when the site offers both appearances.

country: Two-letter ISO 3166-1 alpha-2 country code identifying a supported Context.dev
residential proxy exit location. Must be one of Context.dev's supported
countries. When provided, Context.dev fetches the target page from that country.
country: Fetch the target page through a residential proxy in this country (ISO 3166-1
alpha-2).

direct_url: A specific URL to screenshot directly, bypassing domain resolution (e.g.,
'https://example.com/pricing'). When provided, the screenshot is taken of this
Expand Down Expand Up @@ -3484,9 +3479,8 @@ async def web_crawl_md(
Args:
url: The starting URL for the crawl (must include http:// or https:// protocol)

country: Two-letter ISO 3166-1 alpha-2 country code identifying a supported Context.dev
residential proxy exit location. Must be one of Context.dev's supported
countries. When provided, Context.dev fetches the target page from that country.
country: Fetch the target page through a residential proxy in this country (ISO 3166-1
alpha-2).

exclude_selectors: CSS selectors to remove before each crawled page is converted to Markdown.
Applied after includeSelectors. Exclusion takes precedence: an element matching
Expand Down Expand Up @@ -3834,9 +3828,8 @@ async def web_scrape_html(
content is captured. Requires a paid plan. Send a JSON array in the query
parameter. Maximum: 5 actions.

country: Two-letter ISO 3166-1 alpha-2 country code identifying a supported Context.dev
residential proxy exit location. Must be one of Context.dev's supported
countries. When provided, Context.dev fetches the target page from that country.
country: Fetch the target page through a residential proxy in this country (ISO 3166-1
alpha-2).

exclude_selectors: CSS selectors to remove from the result. Applied after includeSelectors.
Exclusion takes precedence: an element matching both is removed. Examples:
Expand Down Expand Up @@ -4275,9 +4268,8 @@ async def web_scrape_md(
content is captured. Requires a paid plan. Send a JSON array in the query
parameter. Maximum: 5 actions.

country: Two-letter ISO 3166-1 alpha-2 country code identifying a supported Context.dev
residential proxy exit location. Must be one of Context.dev's supported
countries. When provided, Context.dev fetches the target page from that country.
country: Fetch the target page through a residential proxy in this country (ISO 3166-1
alpha-2).

exclude_selectors: CSS selectors to remove before conversion to Markdown. Applied after
includeSelectors. Exclusion takes precedence: an element matching both is
Expand Down
6 changes: 4 additions & 2 deletions src/context/dev/types/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@

from __future__ import annotations

from .error import Error as Error
from .error_count import ErrorCount as ErrorCount
from .intake import Intake as Intake
from .failure import Failure as Failure
from .crawl_controls import CrawlControls as CrawlControls
from .page_error_count import PageErrorCount as PageErrorCount
from .webhook_delivery import WebhookDelivery as WebhookDelivery
from .batch_list_params import BatchListParams as BatchListParams
from .web_search_params import WebSearchParams as WebSearchParams
Expand Down
116 changes: 37 additions & 79 deletions src/context/dev/types/batch_cancel_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,89 +3,46 @@
from typing import List, Optional
from typing_extensions import Literal

from .error import Error
from .intake import Intake
from .._models import BaseModel
from .error_count import ErrorCount
from .crawl_controls import CrawlControls
from .page_error_count import PageErrorCount

__all__ = ["BatchCancelResponse", "Credits", "Input", "Progress", "Results", "ResultsFile", "Timing", "KeyMetadata"]
__all__ = ["BatchCancelResponse", "Credits", "Progress", "Timing", "KeyMetadata"]


class Credits(BaseModel):
"""Reserved and used credits."""
"""What this batch cost so far."""

charged: int
"""Credits used by successful pages."""
reserved: int
"""Credits debited at submission.

estimated: int
"""Credits reserved when the batch was accepted."""


class Input(BaseModel):
"""Submission counts."""

accepted: int
"""Pages accepted, or the crawl page limit. Credits are reserved for this count."""

duplicates: int
"""Duplicate URL and `itemId` pairs skipped. Always 0 for crawls."""

invalid: int
"""Pages rejected during validation."""

submitted: int
"""Pages submitted before validation. For a crawl, the page limit."""
The unspent remainder is refunded once the batch settles — read
`credits.refunded` from GET /batch/{batch_id} then.
"""


class Progress(BaseModel):
"""Current processing counts. Use `status` to check completion."""
"""How far the batch got before cancellation."""

failed: int
"""Pages that could not be scraped."""
"""Pages that could not be scraped before the request landed."""

pending: int
"""Accepted pages not yet attempted.

Always 0 once the batch completes; a crawl can finish under its page limit when
the site has no more reachable pages.
"""
"""Reserved pages that will now be skipped, and refunded when the batch settles."""

succeeded: int
"""Pages scraped successfully."""


class ResultsFile(BaseModel):
bytes: int
"""Compressed file size in bytes."""

items: int
"""Results in this file."""

url: str
"""Temporary URL for a gzipped NDJSON file."""


class Results(BaseModel):
"""Download links available when the batch finishes.

GET /batch/{batch_id}/results serves the same records as paginated JSON.
"""

expires_at: str
"""When the download URLs expire."""

files: List[ResultsFile]
"""Result files. Order is not guaranteed."""
"""Pages scraped successfully before the request landed."""


class Timing(BaseModel):
completed_at: Optional[str] = None
"""When processing finished. Null while active."""
"""There is no finish time yet — the batch is still winding down."""

created_at: str
"""When the batch was created."""

started_at: Optional[str] = None
"""When processing started. Null while queued."""
"""When processing started. Null if it was cancelled while still queued."""


class KeyMetadata(BaseModel):
Expand All @@ -100,42 +57,43 @@ class KeyMetadata(BaseModel):

class BatchCancelResponse(BaseModel):
id: str
"""Batch ID used to retrieve or cancel the job."""
"""Batch ID."""

credits: Credits
"""Reserved and used credits."""
crawl: Optional[CrawlControls] = None
"""
The crawl controls as submitted, so the limits requested can be compared against
what the crawl reached.
"""

error: Optional[Error] = None
"""Why the batch failed."""
credits: Credits
"""What this batch cost so far."""

errors: List[ErrorCount]
"""Page failures grouped by error code."""
format: Literal["markdown", "html"]
"""What each page is returned as."""

input: Input
"""Submission counts."""
input: Intake
"""What submission took in, and what it charged for."""

mode: Literal["scrape", "crawl"]
"""How pages are selected."""
"""How pages were selected."""

page_errors: List[PageErrorCount]
"""Page failures so far, grouped by error code and sorted by count."""

progress: Progress
"""Current processing counts. Use `status` to check completion."""
"""How far the batch got before cancellation."""

results: Optional[Results] = None
"""Download links available when the batch finishes.
status: Literal["cancelling"]
"""Always `cancelling`.

GET /batch/{batch_id}/results serves the same records as paginated JSON.
Work already in flight finishes; the batch reaches `cancelled` shortly after.
"""

status: Literal["queued", "running", "cancelling", "completed", "cancelled", "failed"]
"""Current state. `completed`, `cancelled`, and `failed` are final."""

tags: List[str]
"""Tags stored on the batch at submission."""

timing: Timing

type: Literal["markdown", "html"]
"""Output format."""
"""There is no finish time yet — the batch is still winding down."""

key_metadata: Optional[KeyMetadata] = None
"""API key usage for this request."""
Loading
Loading