Skip to content

Commit 90dcf23

Browse files
feat(api): api update
1 parent 0d3b871 commit 90dcf23

4 files changed

Lines changed: 22 additions & 4 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: 21
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev%2Fcontext.dev-5afee68d7308a77a9ef51fb53917080746f96327c6d745fc029363a7d1494c3c.yml
3-
openapi_spec_hash: b2e32bb58d92a00f6ede04c4f7bf1a34
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev%2Fcontext.dev-571a58f35555a19e8ca5581dc53e6aeb8f9a8d58ae98e2f3c1a1c06463007a9f.yml
3+
openapi_spec_hash: 4ad9b0a6fc6f6c64a84b531fdafa80bf
44
config_hash: 7d13dca2b2c6f71fc463cb6062efa5ea

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -478,6 +478,7 @@ def web_scrape_sitemap(
478478
*,
479479
domain: str,
480480
max_links: int | Omit = omit,
481+
url_regex: str | Omit = omit,
481482
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
482483
# The extra values given here take precedence over values defined on the client or passed to this method.
483484
extra_headers: Headers | None = None,
@@ -494,6 +495,9 @@ def web_scrape_sitemap(
494495
max_links: Maximum number of links to return from the sitemap crawl. Defaults to 10,000.
495496
Minimum is 1, maximum is 100,000.
496497
498+
url_regex: Optional RE2-compatible regex pattern. Only URLs matching this pattern are
499+
returned and counted against maxLinks.
500+
497501
extra_headers: Send extra headers
498502
499503
extra_query: Add additional query parameters to the request
@@ -513,6 +517,7 @@ def web_scrape_sitemap(
513517
{
514518
"domain": domain,
515519
"max_links": max_links,
520+
"url_regex": url_regex,
516521
},
517522
web_web_scrape_sitemap_params.WebWebScrapeSitemapParams,
518523
),
@@ -960,6 +965,7 @@ async def web_scrape_sitemap(
960965
*,
961966
domain: str,
962967
max_links: int | Omit = omit,
968+
url_regex: str | Omit = omit,
963969
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
964970
# The extra values given here take precedence over values defined on the client or passed to this method.
965971
extra_headers: Headers | None = None,
@@ -976,6 +982,9 @@ async def web_scrape_sitemap(
976982
max_links: Maximum number of links to return from the sitemap crawl. Defaults to 10,000.
977983
Minimum is 1, maximum is 100,000.
978984
985+
url_regex: Optional RE2-compatible regex pattern. Only URLs matching this pattern are
986+
returned and counted against maxLinks.
987+
979988
extra_headers: Send extra headers
980989
981990
extra_query: Add additional query parameters to the request
@@ -995,6 +1004,7 @@ async def web_scrape_sitemap(
9951004
{
9961005
"domain": domain,
9971006
"max_links": max_links,
1007+
"url_regex": url_regex,
9981008
},
9991009
web_web_scrape_sitemap_params.WebWebScrapeSitemapParams,
10001010
),

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,9 @@ class WebWebScrapeSitemapParams(TypedDict, total=False):
1818
1919
Defaults to 10,000. Minimum is 1, maximum is 100,000.
2020
"""
21+
22+
url_regex: Annotated[str, PropertyInfo(alias="urlRegex")]
23+
"""Optional RE2-compatible regex pattern.
24+
25+
Only URLs matching this pattern are returned and counted against maxLinks.
26+
"""

‎tests/api_resources/test_web.py‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ def test_method_web_crawl_md_with_all_params(self, client: ContextDev) -> None:
161161
max_depth=0,
162162
max_pages=1,
163163
shorten_base64_images=True,
164-
url_regex="urlRegex",
164+
url_regex="^https?://[^/]+/blog/",
165165
use_main_content_only=True,
166166
)
167167
assert_matches_type(WebWebCrawlMdResponse, web, path=["response"])
@@ -330,6 +330,7 @@ def test_method_web_scrape_sitemap_with_all_params(self, client: ContextDev) ->
330330
web = client.web.web_scrape_sitemap(
331331
domain="domain",
332332
max_links=1,
333+
url_regex="^https?://[^/]+/blog/",
333334
)
334335
assert_matches_type(WebWebScrapeSitemapResponse, web, path=["response"])
335336

@@ -500,7 +501,7 @@ async def test_method_web_crawl_md_with_all_params(self, async_client: AsyncCont
500501
max_depth=0,
501502
max_pages=1,
502503
shorten_base64_images=True,
503-
url_regex="urlRegex",
504+
url_regex="^https?://[^/]+/blog/",
504505
use_main_content_only=True,
505506
)
506507
assert_matches_type(WebWebCrawlMdResponse, web, path=["response"])
@@ -669,6 +670,7 @@ async def test_method_web_scrape_sitemap_with_all_params(self, async_client: Asy
669670
web = await async_client.web.web_scrape_sitemap(
670671
domain="domain",
671672
max_links=1,
673+
url_regex="^https?://[^/]+/blog/",
672674
)
673675
assert_matches_type(WebWebScrapeSitemapResponse, web, path=["response"])
674676

0 commit comments

Comments
 (0)