|
18 | 18 | web_web_scrape_images_params, |
19 | 19 | web_extract_styleguide_params, |
20 | 20 | web_web_scrape_sitemap_params, |
| 21 | + web_extract_competitors_params, |
21 | 22 | ) |
22 | 23 | from .._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given |
23 | 24 | from .._utils import maybe_transform, async_maybe_transform |
|
40 | 41 | from ..types.web_web_scrape_images_response import WebWebScrapeImagesResponse |
41 | 42 | from ..types.web_extract_styleguide_response import WebExtractStyleguideResponse |
42 | 43 | from ..types.web_web_scrape_sitemap_response import WebWebScrapeSitemapResponse |
| 44 | +from ..types.web_extract_competitors_response import WebExtractCompetitorsResponse |
43 | 45 |
|
44 | 46 | __all__ = ["WebResource", "AsyncWebResource"] |
45 | 47 |
|
@@ -155,6 +157,60 @@ def extract( |
155 | 157 | cast_to=WebExtractResponse, |
156 | 158 | ) |
157 | 159 |
|
| 160 | + def extract_competitors( |
| 161 | + self, |
| 162 | + *, |
| 163 | + domain: str, |
| 164 | + num_competitors: int | Omit = omit, |
| 165 | + timeout_ms: int | Omit = omit, |
| 166 | + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. |
| 167 | + # The extra values given here take precedence over values defined on the client or passed to this method. |
| 168 | + extra_headers: Headers | None = None, |
| 169 | + extra_query: Query | None = None, |
| 170 | + extra_body: Body | None = None, |
| 171 | + timeout: float | httpx.Timeout | None | NotGiven = not_given, |
| 172 | + ) -> WebExtractCompetitorsResponse: |
| 173 | + """ |
| 174 | + Analyze a company's landing page and web search evidence to return direct |
| 175 | + competitors for the same product or market. |
| 176 | +
|
| 177 | + Args: |
| 178 | + domain: Company domain to analyze, such as `stripe.com`. Full http(s) URLs are accepted |
| 179 | + and normalized to their domain. |
| 180 | +
|
| 181 | + num_competitors: Exact number of direct competitors to return. Defaults to 5. |
| 182 | +
|
| 183 | + timeout_ms: Optional timeout in milliseconds for the request. If the request takes longer |
| 184 | + than this value, it will be aborted with a 408 status code. Maximum allowed |
| 185 | + value is 300000ms (5 minutes). |
| 186 | +
|
| 187 | + extra_headers: Send extra headers |
| 188 | +
|
| 189 | + extra_query: Add additional query parameters to the request |
| 190 | +
|
| 191 | + extra_body: Add additional JSON properties to the request |
| 192 | +
|
| 193 | + timeout: Override the client-level default timeout for this request, in seconds |
| 194 | + """ |
| 195 | + return self._get( |
| 196 | + "/web/competitors", |
| 197 | + options=make_request_options( |
| 198 | + extra_headers=extra_headers, |
| 199 | + extra_query=extra_query, |
| 200 | + extra_body=extra_body, |
| 201 | + timeout=timeout, |
| 202 | + query=maybe_transform( |
| 203 | + { |
| 204 | + "domain": domain, |
| 205 | + "num_competitors": num_competitors, |
| 206 | + "timeout_ms": timeout_ms, |
| 207 | + }, |
| 208 | + web_extract_competitors_params.WebExtractCompetitorsParams, |
| 209 | + ), |
| 210 | + ), |
| 211 | + cast_to=WebExtractCompetitorsResponse, |
| 212 | + ) |
| 213 | + |
158 | 214 | def extract_fonts( |
159 | 215 | self, |
160 | 216 | *, |
@@ -943,6 +999,60 @@ async def extract( |
943 | 999 | cast_to=WebExtractResponse, |
944 | 1000 | ) |
945 | 1001 |
|
| 1002 | + async def extract_competitors( |
| 1003 | + self, |
| 1004 | + *, |
| 1005 | + domain: str, |
| 1006 | + num_competitors: int | Omit = omit, |
| 1007 | + timeout_ms: int | Omit = omit, |
| 1008 | + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. |
| 1009 | + # The extra values given here take precedence over values defined on the client or passed to this method. |
| 1010 | + extra_headers: Headers | None = None, |
| 1011 | + extra_query: Query | None = None, |
| 1012 | + extra_body: Body | None = None, |
| 1013 | + timeout: float | httpx.Timeout | None | NotGiven = not_given, |
| 1014 | + ) -> WebExtractCompetitorsResponse: |
| 1015 | + """ |
| 1016 | + Analyze a company's landing page and web search evidence to return direct |
| 1017 | + competitors for the same product or market. |
| 1018 | +
|
| 1019 | + Args: |
| 1020 | + domain: Company domain to analyze, such as `stripe.com`. Full http(s) URLs are accepted |
| 1021 | + and normalized to their domain. |
| 1022 | +
|
| 1023 | + num_competitors: Exact number of direct competitors to return. Defaults to 5. |
| 1024 | +
|
| 1025 | + timeout_ms: Optional timeout in milliseconds for the request. If the request takes longer |
| 1026 | + than this value, it will be aborted with a 408 status code. Maximum allowed |
| 1027 | + value is 300000ms (5 minutes). |
| 1028 | +
|
| 1029 | + extra_headers: Send extra headers |
| 1030 | +
|
| 1031 | + extra_query: Add additional query parameters to the request |
| 1032 | +
|
| 1033 | + extra_body: Add additional JSON properties to the request |
| 1034 | +
|
| 1035 | + timeout: Override the client-level default timeout for this request, in seconds |
| 1036 | + """ |
| 1037 | + return await self._get( |
| 1038 | + "/web/competitors", |
| 1039 | + options=make_request_options( |
| 1040 | + extra_headers=extra_headers, |
| 1041 | + extra_query=extra_query, |
| 1042 | + extra_body=extra_body, |
| 1043 | + timeout=timeout, |
| 1044 | + query=await async_maybe_transform( |
| 1045 | + { |
| 1046 | + "domain": domain, |
| 1047 | + "num_competitors": num_competitors, |
| 1048 | + "timeout_ms": timeout_ms, |
| 1049 | + }, |
| 1050 | + web_extract_competitors_params.WebExtractCompetitorsParams, |
| 1051 | + ), |
| 1052 | + ), |
| 1053 | + cast_to=WebExtractCompetitorsResponse, |
| 1054 | + ) |
| 1055 | + |
946 | 1056 | async def extract_fonts( |
947 | 1057 | self, |
948 | 1058 | *, |
@@ -1627,6 +1737,9 @@ def __init__(self, web: WebResource) -> None: |
1627 | 1737 | self.extract = to_raw_response_wrapper( |
1628 | 1738 | web.extract, |
1629 | 1739 | ) |
| 1740 | + self.extract_competitors = to_raw_response_wrapper( |
| 1741 | + web.extract_competitors, |
| 1742 | + ) |
1630 | 1743 | self.extract_fonts = to_raw_response_wrapper( |
1631 | 1744 | web.extract_fonts, |
1632 | 1745 | ) |
@@ -1663,6 +1776,9 @@ def __init__(self, web: AsyncWebResource) -> None: |
1663 | 1776 | self.extract = async_to_raw_response_wrapper( |
1664 | 1777 | web.extract, |
1665 | 1778 | ) |
| 1779 | + self.extract_competitors = async_to_raw_response_wrapper( |
| 1780 | + web.extract_competitors, |
| 1781 | + ) |
1666 | 1782 | self.extract_fonts = async_to_raw_response_wrapper( |
1667 | 1783 | web.extract_fonts, |
1668 | 1784 | ) |
@@ -1699,6 +1815,9 @@ def __init__(self, web: WebResource) -> None: |
1699 | 1815 | self.extract = to_streamed_response_wrapper( |
1700 | 1816 | web.extract, |
1701 | 1817 | ) |
| 1818 | + self.extract_competitors = to_streamed_response_wrapper( |
| 1819 | + web.extract_competitors, |
| 1820 | + ) |
1702 | 1821 | self.extract_fonts = to_streamed_response_wrapper( |
1703 | 1822 | web.extract_fonts, |
1704 | 1823 | ) |
@@ -1735,6 +1854,9 @@ def __init__(self, web: AsyncWebResource) -> None: |
1735 | 1854 | self.extract = async_to_streamed_response_wrapper( |
1736 | 1855 | web.extract, |
1737 | 1856 | ) |
| 1857 | + self.extract_competitors = async_to_streamed_response_wrapper( |
| 1858 | + web.extract_competitors, |
| 1859 | + ) |
1738 | 1860 | self.extract_fonts = async_to_streamed_response_wrapper( |
1739 | 1861 | web.extract_fonts, |
1740 | 1862 | ) |
|
0 commit comments