Skip to content

Commit 639075e

Browse files
feat(api): api update
1 parent ec8ff2d commit 639075e

7 files changed

Lines changed: 5 additions & 331 deletions

File tree

‎.stats.yml‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
configured_endpoints: 21
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev%2Fcontext.dev-fabb017ff3666dbd9571166423c32c9567f9c09448fd7189d147c06666bf0f39.yml
3-
openapi_spec_hash: 2175516001dec1c8c45a1c8416c6fe53
1+
configured_endpoints: 20
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev%2Fcontext.dev-142c1d289d90b82edca3269964fc4fd6595f0e97c36b42a88b6f774fa5e65c10.yml
3+
openapi_spec_hash: 1dc3e05add427f444e7714173c2fe8a9
44
config_hash: 859455bbffc8a009cd9b5eed9b3ba2d7

‎api.md‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ Types:
55
```python
66
from context.dev.types import (
77
WebExtractFontsResponse,
8-
WebScreenshotResponse,
98
WebWebCrawlMdResponse,
109
WebWebScrapeHTMLResponse,
1110
WebWebScrapeImagesResponse,
@@ -17,7 +16,6 @@ from context.dev.types import (
1716
Methods:
1817

1918
- <code title="get /web/fonts">client.web.<a href="./src/context/dev/resources/web.py">extract_fonts</a>(\*\*<a href="src/context/dev/types/web_extract_fonts_params.py">params</a>) -> <a href="./src/context/dev/types/web_extract_fonts_response.py">WebExtractFontsResponse</a></code>
20-
- <code title="get /brand/screenshot">client.web.<a href="./src/context/dev/resources/web.py">screenshot</a>(\*\*<a href="src/context/dev/types/web_screenshot_params.py">params</a>) -> <a href="./src/context/dev/types/web_screenshot_response.py">WebScreenshotResponse</a></code>
2119
- <code title="post /web/crawl">client.web.<a href="./src/context/dev/resources/web.py">web_crawl_md</a>(\*\*<a href="src/context/dev/types/web_web_crawl_md_params.py">params</a>) -> <a href="./src/context/dev/types/web_web_crawl_md_response.py">WebWebCrawlMdResponse</a></code>
2220
- <code title="get /web/scrape/html">client.web.<a href="./src/context/dev/resources/web.py">web_scrape_html</a>(\*\*<a href="src/context/dev/types/web_web_scrape_html_params.py">params</a>) -> <a href="./src/context/dev/types/web_web_scrape_html_response.py">WebWebScrapeHTMLResponse</a></code>
2321
- <code title="get /web/scrape/images">client.web.<a href="./src/context/dev/resources/web.py">web_scrape_images</a>(\*\*<a href="src/context/dev/types/web_web_scrape_images_params.py">params</a>) -> <a href="./src/context/dev/types/web_web_scrape_images_response.py">WebWebScrapeImagesResponse</a></code>

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

Lines changed: 2 additions & 168 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,9 @@
22

33
from __future__ import annotations
44

5-
from typing_extensions import Literal
6-
75
import httpx
86

97
from ..types import (
10-
web_screenshot_params,
118
web_web_crawl_md_params,
129
web_extract_fonts_params,
1310
web_web_scrape_md_params,
@@ -26,7 +23,6 @@
2623
async_to_streamed_response_wrapper,
2724
)
2825
from .._base_client import make_request_options
29-
from ..types.web_screenshot_response import WebScreenshotResponse
3026
from ..types.web_web_crawl_md_response import WebWebCrawlMdResponse
3127
from ..types.web_extract_fonts_response import WebExtractFontsResponse
3228
from ..types.web_web_scrape_md_response import WebWebScrapeMdResponse
@@ -72,8 +68,7 @@ def extract_fonts(
7268
) -> WebExtractFontsResponse:
7369
"""
7470
Scrape font information from a website including font families, usage
75-
statistics, fallbacks, and element/word counts. Either 'domain' or 'directUrl'
76-
must be provided as a query parameter, but not both.
71+
statistics, fallbacks, and element/word counts.
7772
7873
Args:
7974
direct_url: A specific URL to fetch fonts from directly, bypassing domain resolution (e.g.,
@@ -113,80 +108,6 @@ def extract_fonts(
113108
cast_to=WebExtractFontsResponse,
114109
)
115110

116-
def screenshot(
117-
self,
118-
*,
119-
direct_url: str | Omit = omit,
120-
domain: str | Omit = omit,
121-
full_screenshot: Literal["true", "false"] | Omit = omit,
122-
page: Literal["login", "signup", "blog", "careers", "pricing", "terms", "privacy", "contact"] | Omit = omit,
123-
prioritize: Literal["speed", "quality"] | Omit = omit,
124-
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
125-
# The extra values given here take precedence over values defined on the client or passed to this method.
126-
extra_headers: Headers | None = None,
127-
extra_query: Query | None = None,
128-
extra_body: Body | None = None,
129-
timeout: float | httpx.Timeout | None | NotGiven = not_given,
130-
) -> WebScreenshotResponse:
131-
"""Capture a screenshot of a website.
132-
133-
Supports both viewport (standard browser
134-
view) and full-page screenshots. Can also screenshot specific page types (login,
135-
pricing, etc.) by using heuristics to find the appropriate URL. Either 'domain'
136-
or 'directUrl' must be provided as a query parameter, but not both. Returns a
137-
URL to the uploaded screenshot image hosted on our CDN.
138-
139-
Args:
140-
direct_url: A specific URL to screenshot directly, bypassing domain resolution (e.g.,
141-
'https://example.com/pricing'). When provided, the screenshot is taken of this
142-
exact URL.
143-
144-
domain: Domain name to take screenshot of (e.g., 'example.com', 'google.com'). The
145-
domain will be automatically normalized and validated.
146-
147-
full_screenshot: Optional parameter to determine screenshot type. If 'true', takes a full page
148-
screenshot capturing all content. If 'false' or not provided, takes a viewport
149-
screenshot (standard browser view).
150-
151-
page: Optional parameter to specify which page type to screenshot. If provided, the
152-
system will scrape the domain's links and use heuristics to find the most
153-
appropriate URL for the specified page type (30 supported languages). If not
154-
provided, screenshots the main domain landing page. Only applicable when using
155-
'domain', not 'directUrl'.
156-
157-
prioritize: Optional parameter to prioritize screenshot capture. If 'speed', optimizes for
158-
faster capture with basic quality. If 'quality', optimizes for higher quality
159-
with longer wait times. Defaults to 'quality' if not provided.
160-
161-
extra_headers: Send extra headers
162-
163-
extra_query: Add additional query parameters to the request
164-
165-
extra_body: Add additional JSON properties to the request
166-
167-
timeout: Override the client-level default timeout for this request, in seconds
168-
"""
169-
return self._get(
170-
"/brand/screenshot",
171-
options=make_request_options(
172-
extra_headers=extra_headers,
173-
extra_query=extra_query,
174-
extra_body=extra_body,
175-
timeout=timeout,
176-
query=maybe_transform(
177-
{
178-
"direct_url": direct_url,
179-
"domain": domain,
180-
"full_screenshot": full_screenshot,
181-
"page": page,
182-
"prioritize": prioritize,
183-
},
184-
web_screenshot_params.WebScreenshotParams,
185-
),
186-
),
187-
cast_to=WebScreenshotResponse,
188-
)
189-
190111
def web_crawl_md(
191112
self,
192113
*,
@@ -499,8 +420,7 @@ async def extract_fonts(
499420
) -> WebExtractFontsResponse:
500421
"""
501422
Scrape font information from a website including font families, usage
502-
statistics, fallbacks, and element/word counts. Either 'domain' or 'directUrl'
503-
must be provided as a query parameter, but not both.
423+
statistics, fallbacks, and element/word counts.
504424
505425
Args:
506426
direct_url: A specific URL to fetch fonts from directly, bypassing domain resolution (e.g.,
@@ -540,80 +460,6 @@ async def extract_fonts(
540460
cast_to=WebExtractFontsResponse,
541461
)
542462

543-
async def screenshot(
544-
self,
545-
*,
546-
direct_url: str | Omit = omit,
547-
domain: str | Omit = omit,
548-
full_screenshot: Literal["true", "false"] | Omit = omit,
549-
page: Literal["login", "signup", "blog", "careers", "pricing", "terms", "privacy", "contact"] | Omit = omit,
550-
prioritize: Literal["speed", "quality"] | Omit = omit,
551-
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
552-
# The extra values given here take precedence over values defined on the client or passed to this method.
553-
extra_headers: Headers | None = None,
554-
extra_query: Query | None = None,
555-
extra_body: Body | None = None,
556-
timeout: float | httpx.Timeout | None | NotGiven = not_given,
557-
) -> WebScreenshotResponse:
558-
"""Capture a screenshot of a website.
559-
560-
Supports both viewport (standard browser
561-
view) and full-page screenshots. Can also screenshot specific page types (login,
562-
pricing, etc.) by using heuristics to find the appropriate URL. Either 'domain'
563-
or 'directUrl' must be provided as a query parameter, but not both. Returns a
564-
URL to the uploaded screenshot image hosted on our CDN.
565-
566-
Args:
567-
direct_url: A specific URL to screenshot directly, bypassing domain resolution (e.g.,
568-
'https://example.com/pricing'). When provided, the screenshot is taken of this
569-
exact URL.
570-
571-
domain: Domain name to take screenshot of (e.g., 'example.com', 'google.com'). The
572-
domain will be automatically normalized and validated.
573-
574-
full_screenshot: Optional parameter to determine screenshot type. If 'true', takes a full page
575-
screenshot capturing all content. If 'false' or not provided, takes a viewport
576-
screenshot (standard browser view).
577-
578-
page: Optional parameter to specify which page type to screenshot. If provided, the
579-
system will scrape the domain's links and use heuristics to find the most
580-
appropriate URL for the specified page type (30 supported languages). If not
581-
provided, screenshots the main domain landing page. Only applicable when using
582-
'domain', not 'directUrl'.
583-
584-
prioritize: Optional parameter to prioritize screenshot capture. If 'speed', optimizes for
585-
faster capture with basic quality. If 'quality', optimizes for higher quality
586-
with longer wait times. Defaults to 'quality' if not provided.
587-
588-
extra_headers: Send extra headers
589-
590-
extra_query: Add additional query parameters to the request
591-
592-
extra_body: Add additional JSON properties to the request
593-
594-
timeout: Override the client-level default timeout for this request, in seconds
595-
"""
596-
return await self._get(
597-
"/brand/screenshot",
598-
options=make_request_options(
599-
extra_headers=extra_headers,
600-
extra_query=extra_query,
601-
extra_body=extra_body,
602-
timeout=timeout,
603-
query=await async_maybe_transform(
604-
{
605-
"direct_url": direct_url,
606-
"domain": domain,
607-
"full_screenshot": full_screenshot,
608-
"page": page,
609-
"prioritize": prioritize,
610-
},
611-
web_screenshot_params.WebScreenshotParams,
612-
),
613-
),
614-
cast_to=WebScreenshotResponse,
615-
)
616-
617463
async def web_crawl_md(
618464
self,
619465
*,
@@ -898,9 +744,6 @@ def __init__(self, web: WebResource) -> None:
898744
self.extract_fonts = to_raw_response_wrapper(
899745
web.extract_fonts,
900746
)
901-
self.screenshot = to_raw_response_wrapper(
902-
web.screenshot,
903-
)
904747
self.web_crawl_md = to_raw_response_wrapper(
905748
web.web_crawl_md,
906749
)
@@ -925,9 +768,6 @@ def __init__(self, web: AsyncWebResource) -> None:
925768
self.extract_fonts = async_to_raw_response_wrapper(
926769
web.extract_fonts,
927770
)
928-
self.screenshot = async_to_raw_response_wrapper(
929-
web.screenshot,
930-
)
931771
self.web_crawl_md = async_to_raw_response_wrapper(
932772
web.web_crawl_md,
933773
)
@@ -952,9 +792,6 @@ def __init__(self, web: WebResource) -> None:
952792
self.extract_fonts = to_streamed_response_wrapper(
953793
web.extract_fonts,
954794
)
955-
self.screenshot = to_streamed_response_wrapper(
956-
web.screenshot,
957-
)
958795
self.web_crawl_md = to_streamed_response_wrapper(
959796
web.web_crawl_md,
960797
)
@@ -979,9 +816,6 @@ def __init__(self, web: AsyncWebResource) -> None:
979816
self.extract_fonts = async_to_streamed_response_wrapper(
980817
web.extract_fonts,
981818
)
982-
self.screenshot = async_to_streamed_response_wrapper(
983-
web.screenshot,
984-
)
985819
self.web_crawl_md = async_to_streamed_response_wrapper(
986820
web.web_crawl_md,
987821
)

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,8 @@
55
from .ai_ai_query_params import AIAIQueryParams as AIAIQueryParams
66
from .ai_ai_query_response import AIAIQueryResponse as AIAIQueryResponse
77
from .brand_retrieve_params import BrandRetrieveParams as BrandRetrieveParams
8-
from .web_screenshot_params import WebScreenshotParams as WebScreenshotParams
98
from .brand_retrieve_response import BrandRetrieveResponse as BrandRetrieveResponse
109
from .utility_prefetch_params import UtilityPrefetchParams as UtilityPrefetchParams
11-
from .web_screenshot_response import WebScreenshotResponse as WebScreenshotResponse
1210
from .web_web_crawl_md_params import WebWebCrawlMdParams as WebWebCrawlMdParams
1311
from .web_extract_fonts_params import WebExtractFontsParams as WebExtractFontsParams
1412
from .web_web_scrape_md_params import WebWebScrapeMdParams as WebWebScrapeMdParams

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

Lines changed: 0 additions & 48 deletions
This file was deleted.

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

Lines changed: 0 additions & 27 deletions
This file was deleted.

0 commit comments

Comments
 (0)