diff --git a/.release-please-manifest.json b/.release-please-manifest.json index f81bf99..f04d089 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.31.0" + ".": "0.32.0" } \ No newline at end of file diff --git a/.stats.yml b/.stats.yml index 27382d2..f1634d6 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 25 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-de0ba2ed18ec7265b0b20d9639b3da207dd33e354f0a856091902291c6661830.yml -openapi_spec_hash: ae25efc2ac6bcab54bc3f4efaab73a55 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-8f6bc62256b5a4aa44e82389bfefee1d73172856c407567bba11a82fd4203641.yml +openapi_spec_hash: 8b7230de56ecbec4712fa1e81067a75c config_hash: f86a4e06ae5ed725aa79d58d7a8dc27c diff --git a/CHANGELOG.md b/CHANGELOG.md index 33e8517..8728cc7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 0.32.0 (2026-06-07) + +Full Changelog: [v0.31.0...v0.32.0](https://github.com/context-dot-dev/context-python-sdk/compare/v0.31.0...v0.32.0) + +### Features + +* **api:** api update ([7ef921a](https://github.com/context-dot-dev/context-python-sdk/commit/7ef921a84ef020f5c31458d3975be33e5befd065)) + ## 0.31.0 (2026-06-07) Full Changelog: [v0.30.0...v0.31.0](https://github.com/context-dot-dev/context-python-sdk/compare/v0.30.0...v0.31.0) diff --git a/pyproject.toml b/pyproject.toml index 72fc076..7831f68 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "context.dev" -version = "0.31.0" +version = "0.32.0" description = "The official Python library for the context.dev API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/context/dev/_version.py b/src/context/dev/_version.py index 91dd603..554da7b 100644 --- a/src/context/dev/_version.py +++ b/src/context/dev/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "context.dev" -__version__ = "0.31.0" # x-release-please-version +__version__ = "0.32.0" # x-release-please-version diff --git a/src/context/dev/resources/web.py b/src/context/dev/resources/web.py index fc6c06d..c41b40a 100644 --- a/src/context/dev/resources/web.py +++ b/src/context/dev/resources/web.py @@ -503,10 +503,12 @@ def web_crawl_md( self, *, url: str, + exclude_selectors: SequenceNotStr[str] | Omit = omit, follow_subdomains: bool | Omit = omit, include_frames: bool | Omit = omit, include_images: bool | Omit = omit, include_links: bool | Omit = omit, + include_selectors: SequenceNotStr[str] | Omit = omit, max_age_ms: int | Omit = omit, max_depth: int | Omit = omit, max_pages: int | Omit = omit, @@ -531,6 +533,10 @@ def web_crawl_md( Args: url: The starting URL for the crawl (must include http:// or https:// protocol) + exclude_selectors: CSS selectors to remove before each crawled page is converted to Markdown. + Applied after includeSelectors. Exclusion takes precedence: an element matching + both is removed. Examples: "nav", "footer", ".ad-banner", "[aria-hidden=true]". + follow_subdomains: When true, follow links on subdomains of the starting URL's domain (e.g. docs.example.com when starting from example.com). www and apex are always treated as equivalent. @@ -542,6 +548,11 @@ def web_crawl_md( include_links: Preserve hyperlinks in the Markdown output + include_selectors: CSS selectors. When provided, only matching HTML subtrees (and their + descendants) are kept before each crawled page is converted to Markdown. When + omitted, the entire document is kept. Examples: "article.main", "#content", + "[role=main]". + max_age_ms: Return a cached result if a prior scrape for the same parameters exists and is younger than this many milliseconds. Defaults to 1 day (86400000 ms) when omitted. Max is 30 days (2592000000 ms). Set to 0 to always scrape fresh. @@ -585,10 +596,12 @@ def web_crawl_md( body=maybe_transform( { "url": url, + "exclude_selectors": exclude_selectors, "follow_subdomains": follow_subdomains, "include_frames": include_frames, "include_images": include_images, "include_links": include_links, + "include_selectors": include_selectors, "max_age_ms": max_age_ms, "max_depth": max_depth, "max_pages": max_pages, @@ -612,8 +625,10 @@ def web_scrape_html( self, *, url: str, + exclude_selectors: SequenceNotStr[str] | Omit = omit, headers: Dict[str, str] | Omit = omit, include_frames: bool | Omit = omit, + include_selectors: SequenceNotStr[str] | Omit = omit, max_age_ms: int | Omit = omit, pdf: web_web_scrape_html_params.Pdf | Omit = omit, timeout_ms: int | Omit = omit, @@ -631,12 +646,20 @@ def web_scrape_html( Args: url: Full URL to scrape (must include http:// or https:// protocol) + exclude_selectors: CSS selectors to remove from the result. Applied after includeSelectors. + Exclusion takes precedence: an element matching both is removed. Examples: + "nav", "footer", ".ad-banner", "[aria-hidden=true]". + headers: Optional outbound HTTP headers forwarded only to the target URL, sent as deep-object query params such as headers[X-Custom]=value. When provided, caching is bypassed: the result is neither read from nor written to cache. include_frames: When true, iframes are rendered inline into the returned HTML. + include_selectors: CSS selectors. When provided, only matching subtrees (and their descendants) are + kept and everything else is dropped. When omitted, the entire document is kept. + Examples: "article.main", "#content", "[role=main]". + max_age_ms: Return a cached result if a prior scrape for the same parameters exists and is younger than this many milliseconds. Defaults to 1 day (86400000 ms) when omitted. Max is 30 days (2592000000 ms). Set to 0 to always scrape fresh. @@ -670,8 +693,10 @@ def web_scrape_html( query=maybe_transform( { "url": url, + "exclude_selectors": exclude_selectors, "headers": headers, "include_frames": include_frames, + "include_selectors": include_selectors, "max_age_ms": max_age_ms, "pdf": pdf, "timeout_ms": timeout_ms, @@ -759,10 +784,12 @@ def web_scrape_md( self, *, url: str, + exclude_selectors: SequenceNotStr[str] | Omit = omit, headers: Dict[str, str] | Omit = omit, include_frames: bool | Omit = omit, include_images: bool | Omit = omit, include_links: bool | Omit = omit, + include_selectors: SequenceNotStr[str] | Omit = omit, max_age_ms: int | Omit = omit, pdf: web_web_scrape_md_params.Pdf | Omit = omit, shorten_base64_images: bool | Omit = omit, @@ -783,6 +810,10 @@ def web_scrape_md( url: Full URL to scrape into LLM usable Markdown (must include http:// or https:// protocol) + exclude_selectors: CSS selectors to remove before conversion to Markdown. Applied after + includeSelectors. Exclusion takes precedence: an element matching both is + removed. Examples: "nav", "footer", ".ad-banner", "[aria-hidden=true]". + headers: Optional outbound HTTP headers forwarded only to the target URL, sent as deep-object query params such as headers[X-Custom]=value. When provided, caching is bypassed: the result is neither read from nor written to cache. @@ -793,6 +824,10 @@ def web_scrape_md( include_links: Preserve hyperlinks in Markdown output + include_selectors: CSS selectors. When provided, only matching HTML subtrees (and their + descendants) are kept before conversion to Markdown. When omitted, the entire + document is kept. Examples: "article.main", "#content", "[role=main]". + max_age_ms: Return a cached result if a prior scrape for the same parameters exists and is younger than this many milliseconds. Defaults to 1 day (86400000 ms) when omitted. Max is 30 days (2592000000 ms). Set to 0 to always scrape fresh. @@ -830,10 +865,12 @@ def web_scrape_md( query=maybe_transform( { "url": url, + "exclude_selectors": exclude_selectors, "headers": headers, "include_frames": include_frames, "include_images": include_images, "include_links": include_links, + "include_selectors": include_selectors, "max_age_ms": max_age_ms, "pdf": pdf, "shorten_base64_images": shorten_base64_images, @@ -1369,10 +1406,12 @@ async def web_crawl_md( self, *, url: str, + exclude_selectors: SequenceNotStr[str] | Omit = omit, follow_subdomains: bool | Omit = omit, include_frames: bool | Omit = omit, include_images: bool | Omit = omit, include_links: bool | Omit = omit, + include_selectors: SequenceNotStr[str] | Omit = omit, max_age_ms: int | Omit = omit, max_depth: int | Omit = omit, max_pages: int | Omit = omit, @@ -1397,6 +1436,10 @@ async def web_crawl_md( Args: url: The starting URL for the crawl (must include http:// or https:// protocol) + exclude_selectors: CSS selectors to remove before each crawled page is converted to Markdown. + Applied after includeSelectors. Exclusion takes precedence: an element matching + both is removed. Examples: "nav", "footer", ".ad-banner", "[aria-hidden=true]". + follow_subdomains: When true, follow links on subdomains of the starting URL's domain (e.g. docs.example.com when starting from example.com). www and apex are always treated as equivalent. @@ -1408,6 +1451,11 @@ async def web_crawl_md( include_links: Preserve hyperlinks in the Markdown output + include_selectors: CSS selectors. When provided, only matching HTML subtrees (and their + descendants) are kept before each crawled page is converted to Markdown. When + omitted, the entire document is kept. Examples: "article.main", "#content", + "[role=main]". + max_age_ms: Return a cached result if a prior scrape for the same parameters exists and is younger than this many milliseconds. Defaults to 1 day (86400000 ms) when omitted. Max is 30 days (2592000000 ms). Set to 0 to always scrape fresh. @@ -1451,10 +1499,12 @@ async def web_crawl_md( body=await async_maybe_transform( { "url": url, + "exclude_selectors": exclude_selectors, "follow_subdomains": follow_subdomains, "include_frames": include_frames, "include_images": include_images, "include_links": include_links, + "include_selectors": include_selectors, "max_age_ms": max_age_ms, "max_depth": max_depth, "max_pages": max_pages, @@ -1478,8 +1528,10 @@ async def web_scrape_html( self, *, url: str, + exclude_selectors: SequenceNotStr[str] | Omit = omit, headers: Dict[str, str] | Omit = omit, include_frames: bool | Omit = omit, + include_selectors: SequenceNotStr[str] | Omit = omit, max_age_ms: int | Omit = omit, pdf: web_web_scrape_html_params.Pdf | Omit = omit, timeout_ms: int | Omit = omit, @@ -1497,12 +1549,20 @@ async def web_scrape_html( Args: url: Full URL to scrape (must include http:// or https:// protocol) + exclude_selectors: CSS selectors to remove from the result. Applied after includeSelectors. + Exclusion takes precedence: an element matching both is removed. Examples: + "nav", "footer", ".ad-banner", "[aria-hidden=true]". + headers: Optional outbound HTTP headers forwarded only to the target URL, sent as deep-object query params such as headers[X-Custom]=value. When provided, caching is bypassed: the result is neither read from nor written to cache. include_frames: When true, iframes are rendered inline into the returned HTML. + include_selectors: CSS selectors. When provided, only matching subtrees (and their descendants) are + kept and everything else is dropped. When omitted, the entire document is kept. + Examples: "article.main", "#content", "[role=main]". + max_age_ms: Return a cached result if a prior scrape for the same parameters exists and is younger than this many milliseconds. Defaults to 1 day (86400000 ms) when omitted. Max is 30 days (2592000000 ms). Set to 0 to always scrape fresh. @@ -1536,8 +1596,10 @@ async def web_scrape_html( query=await async_maybe_transform( { "url": url, + "exclude_selectors": exclude_selectors, "headers": headers, "include_frames": include_frames, + "include_selectors": include_selectors, "max_age_ms": max_age_ms, "pdf": pdf, "timeout_ms": timeout_ms, @@ -1625,10 +1687,12 @@ async def web_scrape_md( self, *, url: str, + exclude_selectors: SequenceNotStr[str] | Omit = omit, headers: Dict[str, str] | Omit = omit, include_frames: bool | Omit = omit, include_images: bool | Omit = omit, include_links: bool | Omit = omit, + include_selectors: SequenceNotStr[str] | Omit = omit, max_age_ms: int | Omit = omit, pdf: web_web_scrape_md_params.Pdf | Omit = omit, shorten_base64_images: bool | Omit = omit, @@ -1649,6 +1713,10 @@ async def web_scrape_md( url: Full URL to scrape into LLM usable Markdown (must include http:// or https:// protocol) + exclude_selectors: CSS selectors to remove before conversion to Markdown. Applied after + includeSelectors. Exclusion takes precedence: an element matching both is + removed. Examples: "nav", "footer", ".ad-banner", "[aria-hidden=true]". + headers: Optional outbound HTTP headers forwarded only to the target URL, sent as deep-object query params such as headers[X-Custom]=value. When provided, caching is bypassed: the result is neither read from nor written to cache. @@ -1659,6 +1727,10 @@ async def web_scrape_md( include_links: Preserve hyperlinks in Markdown output + include_selectors: CSS selectors. When provided, only matching HTML subtrees (and their + descendants) are kept before conversion to Markdown. When omitted, the entire + document is kept. Examples: "article.main", "#content", "[role=main]". + max_age_ms: Return a cached result if a prior scrape for the same parameters exists and is younger than this many milliseconds. Defaults to 1 day (86400000 ms) when omitted. Max is 30 days (2592000000 ms). Set to 0 to always scrape fresh. @@ -1696,10 +1768,12 @@ async def web_scrape_md( query=await async_maybe_transform( { "url": url, + "exclude_selectors": exclude_selectors, "headers": headers, "include_frames": include_frames, "include_images": include_images, "include_links": include_links, + "include_selectors": include_selectors, "max_age_ms": max_age_ms, "pdf": pdf, "shorten_base64_images": shorten_base64_images, diff --git a/src/context/dev/types/web_web_crawl_md_params.py b/src/context/dev/types/web_web_crawl_md_params.py index 03539b2..c8c7ba5 100644 --- a/src/context/dev/types/web_web_crawl_md_params.py +++ b/src/context/dev/types/web_web_crawl_md_params.py @@ -4,6 +4,7 @@ from typing_extensions import Required, Annotated, TypedDict +from .._types import SequenceNotStr from .._utils import PropertyInfo __all__ = ["WebWebCrawlMdParams", "Pdf"] @@ -13,6 +14,13 @@ class WebWebCrawlMdParams(TypedDict, total=False): url: Required[str] """The starting URL for the crawl (must include http:// or https:// protocol)""" + exclude_selectors: Annotated[SequenceNotStr[str], PropertyInfo(alias="excludeSelectors")] + """CSS selectors to remove before each crawled page is converted to Markdown. + + Applied after includeSelectors. Exclusion takes precedence: an element matching + both is removed. Examples: "nav", "footer", ".ad-banner", "[aria-hidden=true]". + """ + follow_subdomains: Annotated[bool, PropertyInfo(alias="followSubdomains")] """When true, follow links on subdomains of the starting URL's domain (e.g. @@ -32,6 +40,14 @@ class WebWebCrawlMdParams(TypedDict, total=False): include_links: Annotated[bool, PropertyInfo(alias="includeLinks")] """Preserve hyperlinks in the Markdown output""" + include_selectors: Annotated[SequenceNotStr[str], PropertyInfo(alias="includeSelectors")] + """CSS selectors. + + When provided, only matching HTML subtrees (and their descendants) are kept + before each crawled page is converted to Markdown. When omitted, the entire + document is kept. Examples: "article.main", "#content", "[role=main]". + """ + max_age_ms: Annotated[int, PropertyInfo(alias="maxAgeMs")] """ Return a cached result if a prior scrape for the same parameters exists and is diff --git a/src/context/dev/types/web_web_scrape_html_params.py b/src/context/dev/types/web_web_scrape_html_params.py index f734480..0fd5301 100644 --- a/src/context/dev/types/web_web_scrape_html_params.py +++ b/src/context/dev/types/web_web_scrape_html_params.py @@ -5,6 +5,7 @@ from typing import Dict from typing_extensions import Required, Annotated, TypedDict +from .._types import SequenceNotStr from .._utils import PropertyInfo __all__ = ["WebWebScrapeHTMLParams", "Pdf"] @@ -14,6 +15,13 @@ class WebWebScrapeHTMLParams(TypedDict, total=False): url: Required[str] """Full URL to scrape (must include http:// or https:// protocol)""" + exclude_selectors: Annotated[SequenceNotStr[str], PropertyInfo(alias="excludeSelectors")] + """CSS selectors to remove from the result. + + Applied after includeSelectors. Exclusion takes precedence: an element matching + both is removed. Examples: "nav", "footer", ".ad-banner", "[aria-hidden=true]". + """ + headers: Dict[str, str] """ Optional outbound HTTP headers forwarded only to the target URL, sent as @@ -24,6 +32,14 @@ class WebWebScrapeHTMLParams(TypedDict, total=False): include_frames: Annotated[bool, PropertyInfo(alias="includeFrames")] """When true, iframes are rendered inline into the returned HTML.""" + include_selectors: Annotated[SequenceNotStr[str], PropertyInfo(alias="includeSelectors")] + """CSS selectors. + + When provided, only matching subtrees (and their descendants) are kept and + everything else is dropped. When omitted, the entire document is kept. Examples: + "article.main", "#content", "[role=main]". + """ + max_age_ms: Annotated[int, PropertyInfo(alias="maxAgeMs")] """ Return a cached result if a prior scrape for the same parameters exists and is diff --git a/src/context/dev/types/web_web_scrape_md_params.py b/src/context/dev/types/web_web_scrape_md_params.py index 0c27420..d70b458 100644 --- a/src/context/dev/types/web_web_scrape_md_params.py +++ b/src/context/dev/types/web_web_scrape_md_params.py @@ -5,6 +5,7 @@ from typing import Dict from typing_extensions import Required, Annotated, TypedDict +from .._types import SequenceNotStr from .._utils import PropertyInfo __all__ = ["WebWebScrapeMdParams", "Pdf"] @@ -17,6 +18,13 @@ class WebWebScrapeMdParams(TypedDict, total=False): protocol) """ + exclude_selectors: Annotated[SequenceNotStr[str], PropertyInfo(alias="excludeSelectors")] + """CSS selectors to remove before conversion to Markdown. + + Applied after includeSelectors. Exclusion takes precedence: an element matching + both is removed. Examples: "nav", "footer", ".ad-banner", "[aria-hidden=true]". + """ + headers: Dict[str, str] """ Optional outbound HTTP headers forwarded only to the target URL, sent as @@ -33,6 +41,14 @@ class WebWebScrapeMdParams(TypedDict, total=False): include_links: Annotated[bool, PropertyInfo(alias="includeLinks")] """Preserve hyperlinks in Markdown output""" + include_selectors: Annotated[SequenceNotStr[str], PropertyInfo(alias="includeSelectors")] + """CSS selectors. + + When provided, only matching HTML subtrees (and their descendants) are kept + before conversion to Markdown. When omitted, the entire document is kept. + Examples: "article.main", "#content", "[role=main]". + """ + max_age_ms: Annotated[int, PropertyInfo(alias="maxAgeMs")] """ Return a cached result if a prior scrape for the same parameters exists and is diff --git a/tests/api_resources/test_web.py b/tests/api_resources/test_web.py index e90d5ee..6b8b959 100644 --- a/tests/api_resources/test_web.py +++ b/tests/api_resources/test_web.py @@ -353,10 +353,12 @@ def test_method_web_crawl_md(self, client: ContextDev) -> None: def test_method_web_crawl_md_with_all_params(self, client: ContextDev) -> None: web = client.web.web_crawl_md( url="https://example.com", + exclude_selectors=["string"], follow_subdomains=True, include_frames=True, include_images=True, include_links=True, + include_selectors=["string"], max_age_ms=0, max_depth=0, max_pages=1, @@ -413,8 +415,10 @@ def test_method_web_scrape_html(self, client: ContextDev) -> None: def test_method_web_scrape_html_with_all_params(self, client: ContextDev) -> None: web = client.web.web_scrape_html( url="https://example.com", + exclude_selectors=["string"], headers={"foo": "J!"}, include_frames=True, + include_selectors=["string"], max_age_ms=0, pdf={ "end": 1, @@ -517,10 +521,12 @@ def test_method_web_scrape_md(self, client: ContextDev) -> None: def test_method_web_scrape_md_with_all_params(self, client: ContextDev) -> None: web = client.web.web_scrape_md( url="https://example.com", + exclude_selectors=["string"], headers={"foo": "J!"}, include_frames=True, include_images=True, include_links=True, + include_selectors=["string"], max_age_ms=0, pdf={ "end": 1, @@ -936,10 +942,12 @@ async def test_method_web_crawl_md(self, async_client: AsyncContextDev) -> None: async def test_method_web_crawl_md_with_all_params(self, async_client: AsyncContextDev) -> None: web = await async_client.web.web_crawl_md( url="https://example.com", + exclude_selectors=["string"], follow_subdomains=True, include_frames=True, include_images=True, include_links=True, + include_selectors=["string"], max_age_ms=0, max_depth=0, max_pages=1, @@ -996,8 +1004,10 @@ async def test_method_web_scrape_html(self, async_client: AsyncContextDev) -> No async def test_method_web_scrape_html_with_all_params(self, async_client: AsyncContextDev) -> None: web = await async_client.web.web_scrape_html( url="https://example.com", + exclude_selectors=["string"], headers={"foo": "J!"}, include_frames=True, + include_selectors=["string"], max_age_ms=0, pdf={ "end": 1, @@ -1100,10 +1110,12 @@ async def test_method_web_scrape_md(self, async_client: AsyncContextDev) -> None async def test_method_web_scrape_md_with_all_params(self, async_client: AsyncContextDev) -> None: web = await async_client.web.web_scrape_md( url="https://example.com", + exclude_selectors=["string"], headers={"foo": "J!"}, include_frames=True, include_images=True, include_links=True, + include_selectors=["string"], max_age_ms=0, pdf={ "end": 1,