Skip to content

Commit 06c5d6c

Browse files
feat(api): api update
1 parent 3935a16 commit 06c5d6c

5 files changed

Lines changed: 41 additions & 7 deletions

File tree

‎.stats.yml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 38
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-b73de7a5f87b3bed7d9e4259bd109cd62f4eb5f61fa082f31fc22d5bf8e69bcc.yml
3-
openapi_spec_hash: 5dcb5ba9b8487329adc2f89eeb4df7c4
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-b5a46cf886759797353b250da971e46cf66804b825ded9c51609f34d72d1169c.yml
3+
openapi_spec_hash: 1947de2a731ddab05bfb781f37cd42b6
44
config_hash: bff282047fafdad771fb7ec685f56944

‎src/context/dev/resources/web.py‎

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2170,6 +2170,7 @@ def web_scrape_sitemap(
21702170
domain: str,
21712171
headers: Dict[str, str] | Omit = omit,
21722172
max_links: int | Omit = omit,
2173+
search: str | Omit = omit,
21732174
sitemap_url: str | Omit = omit,
21742175
tags: SequenceNotStr[str] | Omit = omit,
21752176
timeout_ms: int | Omit = omit,
@@ -2182,8 +2183,13 @@ def web_scrape_sitemap(
21822183
extra_body: Body | None = None,
21832184
timeout: float | httpx.Timeout | None | NotGiven = not_given,
21842185
) -> WebWebScrapeSitemapResponse:
2185-
"""
2186-
Crawl an entire website's sitemap and return all discovered page URLs.
2186+
"""Crawl an entire website's sitemap and return all discovered page URLs.
2187+
2188+
Pass
2189+
`search` to have the crawled sitemap filtered down to the pages about a phrase
2190+
(for example `pricing and plans` or `api authentication docs`), most relevant
2191+
first — a searched crawl scans the whole sitemap and costs 2 credits instead
2192+
of 1.
21872193
21882194
Args:
21892195
domain: Domain to build a sitemap for
@@ -2195,6 +2201,10 @@ def web_scrape_sitemap(
21952201
max_links: Maximum number of links to return from the sitemap crawl. Defaults to 10,000.
21962202
Minimum is 1, maximum is 100,000.
21972203
2204+
search: Optional search phrase. When provided, the crawled sitemap is filtered to the
2205+
pages whose URLs are about that phrase, most relevant first, and the request
2206+
costs 2 credits instead of 1.
2207+
21982208
sitemap_url: Optional explicit sitemap URL. When provided, exactly this sitemap is crawled
21992209
instead of discovering the domain's sitemaps.
22002210
@@ -2234,6 +2244,7 @@ def web_scrape_sitemap(
22342244
"domain": domain,
22352245
"headers": headers,
22362246
"max_links": max_links,
2247+
"search": search,
22372248
"sitemap_url": sitemap_url,
22382249
"tags": tags,
22392250
"timeout_ms": timeout_ms,
@@ -4371,6 +4382,7 @@ async def web_scrape_sitemap(
43714382
domain: str,
43724383
headers: Dict[str, str] | Omit = omit,
43734384
max_links: int | Omit = omit,
4385+
search: str | Omit = omit,
43744386
sitemap_url: str | Omit = omit,
43754387
tags: SequenceNotStr[str] | Omit = omit,
43764388
timeout_ms: int | Omit = omit,
@@ -4383,8 +4395,13 @@ async def web_scrape_sitemap(
43834395
extra_body: Body | None = None,
43844396
timeout: float | httpx.Timeout | None | NotGiven = not_given,
43854397
) -> WebWebScrapeSitemapResponse:
4386-
"""
4387-
Crawl an entire website's sitemap and return all discovered page URLs.
4398+
"""Crawl an entire website's sitemap and return all discovered page URLs.
4399+
4400+
Pass
4401+
`search` to have the crawled sitemap filtered down to the pages about a phrase
4402+
(for example `pricing and plans` or `api authentication docs`), most relevant
4403+
first — a searched crawl scans the whole sitemap and costs 2 credits instead
4404+
of 1.
43884405
43894406
Args:
43904407
domain: Domain to build a sitemap for
@@ -4396,6 +4413,10 @@ async def web_scrape_sitemap(
43964413
max_links: Maximum number of links to return from the sitemap crawl. Defaults to 10,000.
43974414
Minimum is 1, maximum is 100,000.
43984415
4416+
search: Optional search phrase. When provided, the crawled sitemap is filtered to the
4417+
pages whose URLs are about that phrase, most relevant first, and the request
4418+
costs 2 credits instead of 1.
4419+
43994420
sitemap_url: Optional explicit sitemap URL. When provided, exactly this sitemap is crawled
44004421
instead of discovering the domain's sitemaps.
44014422
@@ -4435,6 +4456,7 @@ async def web_scrape_sitemap(
44354456
"domain": domain,
44364457
"headers": headers,
44374458
"max_links": max_links,
4459+
"search": search,
44384460
"sitemap_url": sitemap_url,
44394461
"tags": tags,
44404462
"timeout_ms": timeout_ms,

‎src/context/dev/types/web_web_scrape_sitemap_params.py‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,13 @@ class WebWebScrapeSitemapParams(TypedDict, total=False):
2828
Defaults to 10,000. Minimum is 1, maximum is 100,000.
2929
"""
3030

31+
search: str
32+
"""Optional search phrase.
33+
34+
When provided, the crawled sitemap is filtered to the pages whose URLs are about
35+
that phrase, most relevant first, and the request costs 2 credits instead of 1.
36+
"""
37+
3138
sitemap_url: Annotated[str, PropertyInfo(alias="sitemapUrl")]
3239
"""Optional explicit sitemap URL.
3340

‎src/context/dev/types/web_web_scrape_sitemap_response.py‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,10 @@ class WebWebScrapeSitemapResponse(BaseModel):
5050
"""Indicates success"""
5151

5252
urls: List[str]
53-
"""Array of discovered page URLs from the sitemap (max 500)"""
53+
"""Discovered page URLs from the sitemap, up to `maxLinks`.
54+
55+
When `search` is set these are only the matching pages, most relevant first.
56+
"""
5457

5558
key_metadata: Optional[KeyMetadata] = None
5659
"""Metadata about the API key used for the request.

‎tests/api_resources/test_web.py‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -633,6 +633,7 @@ def test_method_web_scrape_sitemap_with_all_params(self, client: ContextDev) ->
633633
domain="xxx",
634634
headers={"foo": "J!"},
635635
max_links=1,
636+
search="help center and troubleshooting articles",
636637
sitemap_url="https://example.com",
637638
tags=["production", "team-alpha"],
638639
timeout_ms=1,
@@ -1277,6 +1278,7 @@ async def test_method_web_scrape_sitemap_with_all_params(self, async_client: Asy
12771278
domain="xxx",
12781279
headers={"foo": "J!"},
12791280
max_links=1,
1281+
search="help center and troubleshooting articles",
12801282
sitemap_url="https://example.com",
12811283
tags=["production", "team-alpha"],
12821284
timeout_ms=1,

0 commit comments

Comments
 (0)