Skip to content

Commit 853f56b

Browse files
feat(api): api update
1 parent ff1fd79 commit 853f56b

6 files changed

Lines changed: 106 additions & 27 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: 40
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-a0dda03bbb600917cfb9add468cc4c8c84351a8dbbf61644dbc353263ca1748f.yml
3-
openapi_spec_hash: c24264f32a46d9317aac5af9d6a396f7
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-1c93116e47cab52ea63490f5bca186ed3acda8bbd7f0ce5a320effb9f5b72b1f.yml
3+
openapi_spec_hash: f56204d55bd4bffb6e4d50d6a5d9471a
44
config_hash: 920678668dd2da6f8966fbf1b8fde4e2

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

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2061,17 +2061,17 @@ def web_scrape_md(
20612061
20622062
### Billing & errors
20632063
2064-
| HTTP status | Billed? | Meaning |
2065-
| ----------- | ----------------------------------------- | ---------------------------------------------------------------------------------------- |
2066-
| 200 | Yes — 1 credit, or 2 credits with actions | Successful scrape, including a zero-length result when includeSelectors matched nothing |
2067-
| 400 | No | Invalid input, skipped PDF, or the page could not be scraped |
2068-
| 401 / 403 | No | Invalid/disabled key, insufficient permissions, or credits exhausted; inspect error_code |
2069-
| 404 | No | Target page returned or fingerprinted as not found |
2070-
| 408 | No | Request timed out |
2071-
| 413 | No | Target content exceeds the maximum supported size (20 MB) |
2072-
| 415 | No | Unsupported content type |
2073-
| 429 | No | Per-minute rate limit exceeded; honor Retry-After |
2074-
| 500 | No | Internal error |
2064+
| HTTP status | Billed? | Meaning |
2065+
| ----------- | ----------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
2066+
| 200 | Yes — 1 credit, or 2 credits with actions | Successful scrape, including a zero-length result when includeSelectors matched nothing |
2067+
| 400 | No | Invalid input, skipped PDF, or the page could not be scraped. error_code WEBSITE_BLOCKED specifically means the site answered with an anti-bot challenge, CAPTCHA wall, or login shell instead of the page (even when the site returned HTTP 200) — retrying later or from another country sometimes succeeds |
2068+
| 401 / 403 | No | Invalid/disabled key, insufficient permissions, or credits exhausted; inspect error_code |
2069+
| 404 | No | Target page returned or fingerprinted as not found |
2070+
| 408 | No | Request timed out |
2071+
| 413 | No | Target content exceeds the maximum supported size (20 MB) |
2072+
| 415 | No | Unsupported content type |
2073+
| 429 | No | Per-minute rate limit exceeded; honor Retry-After |
2074+
| 500 | No | Internal error |
20752075
20762076
Args:
20772077
url: Full URL to scrape into LLM usable Markdown (must include http:// or https://
@@ -4285,17 +4285,17 @@ async def web_scrape_md(
42854285
42864286
### Billing & errors
42874287
4288-
| HTTP status | Billed? | Meaning |
4289-
| ----------- | ----------------------------------------- | ---------------------------------------------------------------------------------------- |
4290-
| 200 | Yes — 1 credit, or 2 credits with actions | Successful scrape, including a zero-length result when includeSelectors matched nothing |
4291-
| 400 | No | Invalid input, skipped PDF, or the page could not be scraped |
4292-
| 401 / 403 | No | Invalid/disabled key, insufficient permissions, or credits exhausted; inspect error_code |
4293-
| 404 | No | Target page returned or fingerprinted as not found |
4294-
| 408 | No | Request timed out |
4295-
| 413 | No | Target content exceeds the maximum supported size (20 MB) |
4296-
| 415 | No | Unsupported content type |
4297-
| 429 | No | Per-minute rate limit exceeded; honor Retry-After |
4298-
| 500 | No | Internal error |
4288+
| HTTP status | Billed? | Meaning |
4289+
| ----------- | ----------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
4290+
| 200 | Yes — 1 credit, or 2 credits with actions | Successful scrape, including a zero-length result when includeSelectors matched nothing |
4291+
| 400 | No | Invalid input, skipped PDF, or the page could not be scraped. error_code WEBSITE_BLOCKED specifically means the site answered with an anti-bot challenge, CAPTCHA wall, or login shell instead of the page (even when the site returned HTTP 200) — retrying later or from another country sometimes succeeds |
4292+
| 401 / 403 | No | Invalid/disabled key, insufficient permissions, or credits exhausted; inspect error_code |
4293+
| 404 | No | Target page returned or fingerprinted as not found |
4294+
| 408 | No | Request timed out |
4295+
| 413 | No | Target content exceeds the maximum supported size (20 MB) |
4296+
| 415 | No | Unsupported content type |
4297+
| 429 | No | Per-minute rate limit exceeded; honor Retry-After |
4298+
| 500 | No | Internal error |
42994299
43004300
Args:
43014301
url: Full URL to scrape into LLM usable Markdown (must include http:// or https://

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

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
"DataOk",
1515
"DataOkMetadata",
1616
"DataOkMetadataAlternate",
17+
"DataOkMetadataHeading",
1718
"DataError",
1819
"KeyMetadata",
1920
]
@@ -33,6 +34,14 @@ class DataOkMetadataAlternate(BaseModel):
3334
"""Alternate resource MIME type, when present."""
3435

3536

37+
class DataOkMetadataHeading(BaseModel):
38+
level: int
39+
"""Heading level, 1–6 (from h1–h6)."""
40+
41+
text: str
42+
"""Heading text with whitespace collapsed, truncated to 1000 characters."""
43+
44+
3645
class DataOkMetadata(BaseModel):
3746
"""Metadata extracted from the scraped page HTML."""
3847

@@ -63,6 +72,12 @@ class DataOkMetadata(BaseModel):
6372
favicon: Optional[str] = None
6473
"""Resolved favicon URL, when present."""
6574

75+
headings: Optional[List[DataOkMetadataHeading]] = None
76+
"""Page headings (h1–h6) in document order, extracted from the unfiltered document.
77+
78+
Capped at the first 500 headings. Omitted when the page has none.
79+
"""
80+
6681
image: Optional[str] = None
6782
"""Primary resolved preview image from Open Graph, Twitter, or image metadata."""
6883

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

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,15 @@
66

77
from .._models import BaseModel
88

9-
__all__ = ["WebWebCrawlMdResponse", "Metadata", "Result", "ResultMetadata", "ResultMetadataAlternate", "KeyMetadata"]
9+
__all__ = [
10+
"WebWebCrawlMdResponse",
11+
"Metadata",
12+
"Result",
13+
"ResultMetadata",
14+
"ResultMetadataAlternate",
15+
"ResultMetadataHeading",
16+
"KeyMetadata",
17+
]
1018

1119

1220
class Metadata(BaseModel):
@@ -43,6 +51,14 @@ class ResultMetadataAlternate(BaseModel):
4351
"""Alternate resource MIME type, when present."""
4452

4553

54+
class ResultMetadataHeading(BaseModel):
55+
level: int
56+
"""Heading level, 1–6 (from h1–h6)."""
57+
58+
text: str
59+
"""Heading text with whitespace collapsed, truncated to 1000 characters."""
60+
61+
4662
class ResultMetadata(BaseModel):
4763
crawl_depth: int = FieldInfo(alias="crawlDepth")
4864
"""Depth relative to the start URL. 0 = start URL, 1 = one link away."""
@@ -86,6 +102,12 @@ class ResultMetadata(BaseModel):
86102
favicon: Optional[str] = None
87103
"""Resolved favicon URL, when present."""
88104

105+
headings: Optional[List[ResultMetadataHeading]] = None
106+
"""Page headings (h1–h6) in document order, extracted from the unfiltered document.
107+
108+
Capped at the first 500 headings. Omitted when the page has none.
109+
"""
110+
89111
image: Optional[str] = None
90112
"""Primary resolved preview image from Open Graph, Twitter, or image metadata."""
91113

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

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,14 @@
77

88
from .._models import BaseModel
99

10-
__all__ = ["WebWebScrapeHTMLResponse", "Metadata", "MetadataAlternate", "ActionsApplied", "KeyMetadata"]
10+
__all__ = [
11+
"WebWebScrapeHTMLResponse",
12+
"Metadata",
13+
"MetadataAlternate",
14+
"MetadataHeading",
15+
"ActionsApplied",
16+
"KeyMetadata",
17+
]
1118

1219

1320
class MetadataAlternate(BaseModel):
@@ -24,6 +31,14 @@ class MetadataAlternate(BaseModel):
2431
"""Alternate resource MIME type, when present."""
2532

2633

34+
class MetadataHeading(BaseModel):
35+
level: int
36+
"""Heading level, 1–6 (from h1–h6)."""
37+
38+
text: str
39+
"""Heading text with whitespace collapsed, truncated to 1000 characters."""
40+
41+
2742
class Metadata(BaseModel):
2843
"""Metadata extracted from the scraped page HTML."""
2944

@@ -54,6 +69,12 @@ class Metadata(BaseModel):
5469
favicon: Optional[str] = None
5570
"""Resolved favicon URL, when present."""
5671

72+
headings: Optional[List[MetadataHeading]] = None
73+
"""Page headings (h1–h6) in document order, extracted from the unfiltered document.
74+
75+
Capped at the first 500 headings. Omitted when the page has none.
76+
"""
77+
5778
image: Optional[str] = None
5879
"""Primary resolved preview image from Open Graph, Twitter, or image metadata."""
5980

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

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,14 @@
77

88
from .._models import BaseModel
99

10-
__all__ = ["WebWebScrapeMdResponse", "Metadata", "MetadataAlternate", "ActionsApplied", "KeyMetadata"]
10+
__all__ = [
11+
"WebWebScrapeMdResponse",
12+
"Metadata",
13+
"MetadataAlternate",
14+
"MetadataHeading",
15+
"ActionsApplied",
16+
"KeyMetadata",
17+
]
1118

1219

1320
class MetadataAlternate(BaseModel):
@@ -24,6 +31,14 @@ class MetadataAlternate(BaseModel):
2431
"""Alternate resource MIME type, when present."""
2532

2633

34+
class MetadataHeading(BaseModel):
35+
level: int
36+
"""Heading level, 1–6 (from h1–h6)."""
37+
38+
text: str
39+
"""Heading text with whitespace collapsed, truncated to 1000 characters."""
40+
41+
2742
class Metadata(BaseModel):
2843
"""Metadata extracted from the scraped page HTML."""
2944

@@ -54,6 +69,12 @@ class Metadata(BaseModel):
5469
favicon: Optional[str] = None
5570
"""Resolved favicon URL, when present."""
5671

72+
headings: Optional[List[MetadataHeading]] = None
73+
"""Page headings (h1–h6) in document order, extracted from the unfiltered document.
74+
75+
Capped at the first 500 headings. Omitted when the page has none.
76+
"""
77+
5778
image: Optional[str] = None
5879
"""Primary resolved preview image from Open Graph, Twitter, or image metadata."""
5980

0 commit comments

Comments
 (0)