22
33from __future__ import annotations
44
5- from typing_extensions import Literal
6-
75import httpx
86
97from ..types import (
10- web_screenshot_params ,
118 web_web_crawl_md_params ,
129 web_extract_fonts_params ,
1310 web_web_scrape_md_params ,
2623 async_to_streamed_response_wrapper ,
2724)
2825from .._base_client import make_request_options
29- from ..types .web_screenshot_response import WebScreenshotResponse
3026from ..types .web_web_crawl_md_response import WebWebCrawlMdResponse
3127from ..types .web_extract_fonts_response import WebExtractFontsResponse
3228from ..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 )
0 commit comments