diff --git a/.release-please-manifest.json b/.release-please-manifest.json index d0ab664..2a8f4ff 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.2.0" + ".": "1.3.0" } \ No newline at end of file diff --git a/.stats.yml b/.stats.yml index e34b116..5bb2078 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 25 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-4903d5902cec6a80f42b9adaa9cf0defa9805ff22d7ae96970d209a4f867e195.yml -openapi_spec_hash: 1097891c23530dfe0155f23170daf973 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-021b48afe1d6e3f54c4ebe3d0da4beb3fb8b69a6d384a4aeadbc5bab7f967603.yml +openapi_spec_hash: 2aa5b59d78c708b094acf29cc0d9a68a config_hash: c7b0cdaba3b9797b77efd89e1754d803 diff --git a/CHANGELOG.md b/CHANGELOG.md index 7dfe38d..ccedbfa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,16 @@ # Changelog +## 1.3.0 (2026-06-27) + +Full Changelog: [v1.2.0...v1.3.0](https://github.com/context-dot-dev/context-python-sdk/compare/v1.2.0...v1.3.0) + +### Features + +* **api:** api update ([33f8f8a](https://github.com/context-dot-dev/context-python-sdk/commit/33f8f8a08a90748790a99c3cc7ce7a573af9575f)) +* **api:** api update ([de020ba](https://github.com/context-dot-dev/context-python-sdk/commit/de020ba84656fed630deec2bf184ce4ca532f7b0)) +* **api:** api update ([e9fb3b8](https://github.com/context-dot-dev/context-python-sdk/commit/e9fb3b8875c03ee4d0e259a7a26bde6592693f55)) +* **api:** api update ([5e04d2a](https://github.com/context-dot-dev/context-python-sdk/commit/5e04d2ae7fdc512f33b30a572cdf6ff9e559b17e)) + ## 1.2.0 (2026-06-25) Full Changelog: [v1.1.0...v1.2.0](https://github.com/context-dot-dev/context-python-sdk/compare/v1.1.0...v1.2.0) diff --git a/pyproject.toml b/pyproject.toml index 69032f3..315b9a6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "context.dev" -version = "1.2.0" +version = "1.3.0" description = "The official Python library for the context.dev API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/context/dev/_version.py b/src/context/dev/_version.py index bbb9761..70d3d53 100644 --- a/src/context/dev/_version.py +++ b/src/context/dev/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "context.dev" -__version__ = "1.2.0" # x-release-please-version +__version__ = "1.3.0" # x-release-please-version diff --git a/src/context/dev/resources/web.py b/src/context/dev/resources/web.py index b320e57..cbaff7d 100644 --- a/src/context/dev/resources/web.py +++ b/src/context/dev/resources/web.py @@ -288,6 +288,7 @@ def extract_fonts( def extract_styleguide( self, *, + color_scheme: Literal["light", "dark"] | Omit = omit, direct_url: str | Omit = omit, domain: str | Omit = omit, max_age_ms: int | Omit = omit, @@ -304,6 +305,9 @@ def extract_styleguide( typography, spacing, shadows, and UI components. Args: + color_scheme: Optional browser color scheme to emulate for websites that respond to + prefers-color-scheme. This value is part of the styleguide cache key. + direct_url: A specific URL to fetch the styleguide from directly, bypassing domain resolution (e.g., 'https://example.com/design-system'). When provided, the styleguide is extracted from this exact URL. You must provide either 'domain' or @@ -339,6 +343,7 @@ def extract_styleguide( timeout=timeout, query=maybe_transform( { + "color_scheme": color_scheme, "direct_url": direct_url, "domain": domain, "max_age_ms": max_age_ms, @@ -353,6 +358,214 @@ def extract_styleguide( def screenshot( self, *, + color_scheme: Literal["light", "dark"] | Omit = omit, + country: Literal[ + "ad", + "ae", + "af", + "ag", + "ai", + "al", + "am", + "ao", + "ar", + "at", + "au", + "aw", + "az", + "ba", + "bb", + "bd", + "be", + "bf", + "bg", + "bh", + "bi", + "bj", + "bm", + "bn", + "bo", + "bq", + "br", + "bs", + "bw", + "by", + "bz", + "ca", + "cd", + "cf", + "cg", + "ch", + "ci", + "cl", + "cm", + "cn", + "co", + "cr", + "cv", + "cw", + "cy", + "cz", + "de", + "dj", + "dk", + "dm", + "do", + "dz", + "ec", + "ee", + "eg", + "es", + "et", + "fi", + "fj", + "fr", + "ga", + "gb", + "gd", + "ge", + "gf", + "gg", + "gh", + "gm", + "gn", + "gp", + "gq", + "gr", + "gt", + "gu", + "gw", + "gy", + "hk", + "hn", + "hr", + "ht", + "hu", + "id", + "ie", + "il", + "im", + "in", + "iq", + "ir", + "is", + "it", + "je", + "jm", + "jo", + "jp", + "ke", + "kg", + "kh", + "kn", + "kr", + "kw", + "ky", + "kz", + "la", + "lb", + "lc", + "lk", + "lr", + "ls", + "lt", + "lu", + "lv", + "ly", + "ma", + "mc", + "md", + "me", + "mf", + "mg", + "mk", + "ml", + "mm", + "mn", + "mo", + "mq", + "mr", + "mt", + "mu", + "mv", + "mw", + "mx", + "my", + "mz", + "na", + "nc", + "ne", + "ng", + "ni", + "nl", + "no", + "np", + "nz", + "om", + "pa", + "pe", + "pf", + "pg", + "ph", + "pk", + "pl", + "pr", + "ps", + "pt", + "py", + "qa", + "re", + "ro", + "rs", + "ru", + "rw", + "sa", + "sc", + "sd", + "se", + "sg", + "si", + "sk", + "sl", + "sm", + "sn", + "so", + "sr", + "ss", + "st", + "sv", + "sx", + "sy", + "sz", + "tc", + "td", + "tg", + "th", + "tj", + "tl", + "tm", + "tn", + "tr", + "tt", + "tw", + "tz", + "ua", + "ug", + "us", + "uy", + "uz", + "vc", + "ve", + "vg", + "vi", + "vn", + "ye", + "yt", + "za", + "zm", + "zw", + ] + | Omit = omit, direct_url: str | Omit = omit, domain: str | Omit = omit, full_screenshot: Literal["true", "false"] | Omit = omit, @@ -374,6 +587,12 @@ def screenshot( Capture a screenshot of a website. Args: + color_scheme: Optional parameter to choose the site's visual theme in the screenshot. Use + 'light' or 'dark' when the site offers both appearances. + + country: Two-letter ISO 3166-1 alpha-2 country code for the website request location. + When provided, Context.dev fetches the target page from that country. + direct_url: A specific URL to screenshot directly, bypassing domain resolution (e.g., 'https://example.com/pricing'). When provided, the screenshot is taken of this exact URL. You must provide either 'domain' or 'directUrl', but not both. @@ -434,6 +653,8 @@ def screenshot( timeout=timeout, query=maybe_transform( { + "color_scheme": color_scheme, + "country": country, "direct_url": direct_url, "domain": domain, "full_screenshot": full_screenshot, @@ -455,10 +676,253 @@ def search( self, *, query: str, + country: Literal[ + "af", + "al", + "dz", + "as", + "ad", + "ao", + "ai", + "aq", + "ag", + "ar", + "am", + "aw", + "au", + "at", + "az", + "bs", + "bh", + "bd", + "bb", + "by", + "be", + "bz", + "bj", + "bm", + "bt", + "bo", + "ba", + "bw", + "bv", + "br", + "io", + "bn", + "bg", + "bf", + "bi", + "kh", + "cm", + "ca", + "cv", + "ky", + "cf", + "td", + "cl", + "cn", + "cx", + "cc", + "co", + "km", + "cg", + "cd", + "ck", + "cr", + "ci", + "hr", + "cu", + "cy", + "cz", + "dk", + "dj", + "dm", + "do", + "ec", + "eg", + "sv", + "gq", + "er", + "ee", + "et", + "fk", + "fo", + "fj", + "fi", + "fr", + "gf", + "pf", + "tf", + "ga", + "gm", + "ge", + "de", + "gh", + "gi", + "gr", + "gl", + "gd", + "gp", + "gu", + "gt", + "gn", + "gw", + "gy", + "ht", + "hm", + "va", + "hn", + "hk", + "hu", + "is", + "in", + "id", + "ir", + "iq", + "ie", + "il", + "it", + "jm", + "jp", + "jo", + "kz", + "ke", + "ki", + "kp", + "kr", + "kw", + "kg", + "la", + "lv", + "lb", + "ls", + "lr", + "ly", + "li", + "lt", + "lu", + "mo", + "mk", + "mg", + "mw", + "my", + "mv", + "ml", + "mt", + "mh", + "mq", + "mr", + "mu", + "yt", + "mx", + "fm", + "md", + "mc", + "mn", + "ms", + "ma", + "mz", + "mm", + "na", + "nr", + "np", + "nl", + "an", + "nc", + "nz", + "ni", + "ne", + "ng", + "nu", + "nf", + "mp", + "no", + "om", + "pk", + "pw", + "ps", + "pa", + "pg", + "py", + "pe", + "ph", + "pn", + "pl", + "pt", + "pr", + "qa", + "re", + "ro", + "ru", + "rw", + "sh", + "kn", + "lc", + "pm", + "vc", + "ws", + "sm", + "st", + "sa", + "sn", + "rs", + "sc", + "sl", + "sg", + "sk", + "si", + "sb", + "so", + "za", + "gs", + "es", + "lk", + "sd", + "sr", + "sj", + "sz", + "se", + "ch", + "sy", + "tw", + "tj", + "tz", + "th", + "tl", + "tg", + "tk", + "to", + "tt", + "tn", + "tr", + "tm", + "tc", + "tv", + "ug", + "ua", + "ae", + "gb", + "us", + "um", + "uy", + "uz", + "vu", + "ve", + "vn", + "vg", + "vi", + "wf", + "eh", + "ye", + "zm", + "zw", + ] + | Omit = omit, exclude_domains: SequenceNotStr[str] | Omit = omit, freshness: Literal["last_24_hours", "last_week", "last_month", "last_year"] | Omit = omit, include_domains: SequenceNotStr[str] | Omit = omit, markdown_options: web_search_params.MarkdownOptions | Omit = omit, + num_results: int | Omit = omit, query_fanout: bool | Omit = omit, timeout_ms: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -472,7 +936,11 @@ def search( Search the web and optionally scrape each result to Markdown in one round-trip. Args: - query: Natural-language search query. + query: Search query. Accepts natural language as well as Google-style search operators + such as `site:`, `-site:`, `inurl:`, `intitle:`, quoted phrases, and `OR`. + + country: Two-letter ISO 3166-1 alpha-2 country code to localize results to a specific + country (maps to Google's `gl` parameter). Example: "us", "gb", "de". exclude_domains: Blocklist — drop results from these domains. Example: ["pinterest.com", "reddit.com"]. @@ -484,6 +952,8 @@ def search( markdown_options: Inline Markdown scraping for each result. Set `enabled: true` to activate. + num_results: Number of results to request and return (10–100). Defaults to 10. + query_fanout: Expand the query into multiple parallel variants for broader recall. timeout_ms: Optional timeout in milliseconds for the request. If the request takes longer @@ -503,10 +973,12 @@ def search( body=maybe_transform( { "query": query, + "country": country, "exclude_domains": exclude_domains, "freshness": freshness, "include_domains": include_domains, "markdown_options": markdown_options, + "num_results": num_results, "query_fanout": query_fanout, "timeout_ms": timeout_ms, }, @@ -522,6 +994,213 @@ def web_crawl_md( self, *, url: str, + country: Literal[ + "ad", + "ae", + "af", + "ag", + "ai", + "al", + "am", + "ao", + "ar", + "at", + "au", + "aw", + "az", + "ba", + "bb", + "bd", + "be", + "bf", + "bg", + "bh", + "bi", + "bj", + "bm", + "bn", + "bo", + "bq", + "br", + "bs", + "bw", + "by", + "bz", + "ca", + "cd", + "cf", + "cg", + "ch", + "ci", + "cl", + "cm", + "cn", + "co", + "cr", + "cv", + "cw", + "cy", + "cz", + "de", + "dj", + "dk", + "dm", + "do", + "dz", + "ec", + "ee", + "eg", + "es", + "et", + "fi", + "fj", + "fr", + "ga", + "gb", + "gd", + "ge", + "gf", + "gg", + "gh", + "gm", + "gn", + "gp", + "gq", + "gr", + "gt", + "gu", + "gw", + "gy", + "hk", + "hn", + "hr", + "ht", + "hu", + "id", + "ie", + "il", + "im", + "in", + "iq", + "ir", + "is", + "it", + "je", + "jm", + "jo", + "jp", + "ke", + "kg", + "kh", + "kn", + "kr", + "kw", + "ky", + "kz", + "la", + "lb", + "lc", + "lk", + "lr", + "ls", + "lt", + "lu", + "lv", + "ly", + "ma", + "mc", + "md", + "me", + "mf", + "mg", + "mk", + "ml", + "mm", + "mn", + "mo", + "mq", + "mr", + "mt", + "mu", + "mv", + "mw", + "mx", + "my", + "mz", + "na", + "nc", + "ne", + "ng", + "ni", + "nl", + "no", + "np", + "nz", + "om", + "pa", + "pe", + "pf", + "pg", + "ph", + "pk", + "pl", + "pr", + "ps", + "pt", + "py", + "qa", + "re", + "ro", + "rs", + "ru", + "rw", + "sa", + "sc", + "sd", + "se", + "sg", + "si", + "sk", + "sl", + "sm", + "sn", + "so", + "sr", + "ss", + "st", + "sv", + "sx", + "sy", + "sz", + "tc", + "td", + "tg", + "th", + "tj", + "tl", + "tm", + "tn", + "tr", + "tt", + "tw", + "tz", + "ua", + "ug", + "us", + "uy", + "uz", + "vc", + "ve", + "vg", + "vi", + "vn", + "ye", + "yt", + "za", + "zm", + "zw", + ] + | Omit = omit, exclude_selectors: SequenceNotStr[str] | Omit = omit, follow_subdomains: bool | Omit = omit, include_frames: bool | Omit = omit, @@ -552,6 +1231,10 @@ def web_crawl_md( Args: url: The starting URL for the crawl (must include http:// or https:// protocol) + country: Two-letter ISO 3166-1 alpha-2 country code identifying a supported Context.dev + residential proxy exit location. Must be one of Context.dev's supported + countries. When provided, Context.dev fetches the target page from that country. + exclude_selectors: CSS selectors to remove before each crawled page is converted to Markdown. Applied after includeSelectors. Exclusion takes precedence: an element matching both is removed. Examples: "nav", "footer", ".ad-banner", "[aria-hidden=true]". @@ -615,6 +1298,7 @@ def web_crawl_md( body=maybe_transform( { "url": url, + "country": country, "exclude_selectors": exclude_selectors, "follow_subdomains": follow_subdomains, "include_frames": include_frames, @@ -644,6 +1328,213 @@ def web_scrape_html( self, *, url: str, + country: Literal[ + "ad", + "ae", + "af", + "ag", + "ai", + "al", + "am", + "ao", + "ar", + "at", + "au", + "aw", + "az", + "ba", + "bb", + "bd", + "be", + "bf", + "bg", + "bh", + "bi", + "bj", + "bm", + "bn", + "bo", + "bq", + "br", + "bs", + "bw", + "by", + "bz", + "ca", + "cd", + "cf", + "cg", + "ch", + "ci", + "cl", + "cm", + "cn", + "co", + "cr", + "cv", + "cw", + "cy", + "cz", + "de", + "dj", + "dk", + "dm", + "do", + "dz", + "ec", + "ee", + "eg", + "es", + "et", + "fi", + "fj", + "fr", + "ga", + "gb", + "gd", + "ge", + "gf", + "gg", + "gh", + "gm", + "gn", + "gp", + "gq", + "gr", + "gt", + "gu", + "gw", + "gy", + "hk", + "hn", + "hr", + "ht", + "hu", + "id", + "ie", + "il", + "im", + "in", + "iq", + "ir", + "is", + "it", + "je", + "jm", + "jo", + "jp", + "ke", + "kg", + "kh", + "kn", + "kr", + "kw", + "ky", + "kz", + "la", + "lb", + "lc", + "lk", + "lr", + "ls", + "lt", + "lu", + "lv", + "ly", + "ma", + "mc", + "md", + "me", + "mf", + "mg", + "mk", + "ml", + "mm", + "mn", + "mo", + "mq", + "mr", + "mt", + "mu", + "mv", + "mw", + "mx", + "my", + "mz", + "na", + "nc", + "ne", + "ng", + "ni", + "nl", + "no", + "np", + "nz", + "om", + "pa", + "pe", + "pf", + "pg", + "ph", + "pk", + "pl", + "pr", + "ps", + "pt", + "py", + "qa", + "re", + "ro", + "rs", + "ru", + "rw", + "sa", + "sc", + "sd", + "se", + "sg", + "si", + "sk", + "sl", + "sm", + "sn", + "so", + "sr", + "ss", + "st", + "sv", + "sx", + "sy", + "sz", + "tc", + "td", + "tg", + "th", + "tj", + "tl", + "tm", + "tn", + "tr", + "tt", + "tw", + "tz", + "ua", + "ug", + "us", + "uy", + "uz", + "vc", + "ve", + "vg", + "vi", + "vn", + "ye", + "yt", + "za", + "zm", + "zw", + ] + | Omit = omit, exclude_selectors: SequenceNotStr[str] | Omit = omit, headers: Dict[str, str] | Omit = omit, include_frames: bool | Omit = omit, @@ -666,6 +1557,9 @@ def web_scrape_html( Args: url: Full URL to scrape (must include http:// or https:// protocol) + country: Two-letter ISO 3166-1 alpha-2 country code for the website request location. + When provided, Context.dev fetches the target page from that country. + exclude_selectors: CSS selectors to remove from the result. Applied after includeSelectors. Exclusion takes precedence: an element matching both is removed. Examples: "nav", "footer", ".ad-banner", "[aria-hidden=true]". @@ -716,6 +1610,7 @@ def web_scrape_html( query=maybe_transform( { "url": url, + "country": country, "exclude_selectors": exclude_selectors, "headers": headers, "include_frames": include_frames, @@ -808,6 +1703,213 @@ def web_scrape_md( self, *, url: str, + country: Literal[ + "ad", + "ae", + "af", + "ag", + "ai", + "al", + "am", + "ao", + "ar", + "at", + "au", + "aw", + "az", + "ba", + "bb", + "bd", + "be", + "bf", + "bg", + "bh", + "bi", + "bj", + "bm", + "bn", + "bo", + "bq", + "br", + "bs", + "bw", + "by", + "bz", + "ca", + "cd", + "cf", + "cg", + "ch", + "ci", + "cl", + "cm", + "cn", + "co", + "cr", + "cv", + "cw", + "cy", + "cz", + "de", + "dj", + "dk", + "dm", + "do", + "dz", + "ec", + "ee", + "eg", + "es", + "et", + "fi", + "fj", + "fr", + "ga", + "gb", + "gd", + "ge", + "gf", + "gg", + "gh", + "gm", + "gn", + "gp", + "gq", + "gr", + "gt", + "gu", + "gw", + "gy", + "hk", + "hn", + "hr", + "ht", + "hu", + "id", + "ie", + "il", + "im", + "in", + "iq", + "ir", + "is", + "it", + "je", + "jm", + "jo", + "jp", + "ke", + "kg", + "kh", + "kn", + "kr", + "kw", + "ky", + "kz", + "la", + "lb", + "lc", + "lk", + "lr", + "ls", + "lt", + "lu", + "lv", + "ly", + "ma", + "mc", + "md", + "me", + "mf", + "mg", + "mk", + "ml", + "mm", + "mn", + "mo", + "mq", + "mr", + "mt", + "mu", + "mv", + "mw", + "mx", + "my", + "mz", + "na", + "nc", + "ne", + "ng", + "ni", + "nl", + "no", + "np", + "nz", + "om", + "pa", + "pe", + "pf", + "pg", + "ph", + "pk", + "pl", + "pr", + "ps", + "pt", + "py", + "qa", + "re", + "ro", + "rs", + "ru", + "rw", + "sa", + "sc", + "sd", + "se", + "sg", + "si", + "sk", + "sl", + "sm", + "sn", + "so", + "sr", + "ss", + "st", + "sv", + "sx", + "sy", + "sz", + "tc", + "td", + "tg", + "th", + "tj", + "tl", + "tm", + "tn", + "tr", + "tt", + "tw", + "tz", + "ua", + "ug", + "us", + "uy", + "uz", + "vc", + "ve", + "vg", + "vi", + "vn", + "ye", + "yt", + "za", + "zm", + "zw", + ] + | Omit = omit, exclude_selectors: SequenceNotStr[str] | Omit = omit, headers: Dict[str, str] | Omit = omit, include_frames: bool | Omit = omit, @@ -834,6 +1936,9 @@ def web_scrape_md( url: Full URL to scrape into LLM usable Markdown (must include http:// or https:// protocol) + country: Two-letter ISO 3166-1 alpha-2 country code for the website request location. + When provided, Context.dev fetches the target page from that country. + exclude_selectors: CSS selectors to remove before conversion to Markdown. Applied after includeSelectors. Exclusion takes precedence: an element matching both is removed. Examples: "nav", "footer", ".ad-banner", "[aria-hidden=true]". @@ -889,6 +1994,7 @@ def web_scrape_md( query=maybe_transform( { "url": url, + "country": country, "exclude_selectors": exclude_selectors, "headers": headers, "include_frames": include_frames, @@ -1215,6 +2321,7 @@ async def extract_fonts( async def extract_styleguide( self, *, + color_scheme: Literal["light", "dark"] | Omit = omit, direct_url: str | Omit = omit, domain: str | Omit = omit, max_age_ms: int | Omit = omit, @@ -1231,6 +2338,9 @@ async def extract_styleguide( typography, spacing, shadows, and UI components. Args: + color_scheme: Optional browser color scheme to emulate for websites that respond to + prefers-color-scheme. This value is part of the styleguide cache key. + direct_url: A specific URL to fetch the styleguide from directly, bypassing domain resolution (e.g., 'https://example.com/design-system'). When provided, the styleguide is extracted from this exact URL. You must provide either 'domain' or @@ -1266,6 +2376,7 @@ async def extract_styleguide( timeout=timeout, query=await async_maybe_transform( { + "color_scheme": color_scheme, "direct_url": direct_url, "domain": domain, "max_age_ms": max_age_ms, @@ -1280,6 +2391,214 @@ async def extract_styleguide( async def screenshot( self, *, + color_scheme: Literal["light", "dark"] | Omit = omit, + country: Literal[ + "ad", + "ae", + "af", + "ag", + "ai", + "al", + "am", + "ao", + "ar", + "at", + "au", + "aw", + "az", + "ba", + "bb", + "bd", + "be", + "bf", + "bg", + "bh", + "bi", + "bj", + "bm", + "bn", + "bo", + "bq", + "br", + "bs", + "bw", + "by", + "bz", + "ca", + "cd", + "cf", + "cg", + "ch", + "ci", + "cl", + "cm", + "cn", + "co", + "cr", + "cv", + "cw", + "cy", + "cz", + "de", + "dj", + "dk", + "dm", + "do", + "dz", + "ec", + "ee", + "eg", + "es", + "et", + "fi", + "fj", + "fr", + "ga", + "gb", + "gd", + "ge", + "gf", + "gg", + "gh", + "gm", + "gn", + "gp", + "gq", + "gr", + "gt", + "gu", + "gw", + "gy", + "hk", + "hn", + "hr", + "ht", + "hu", + "id", + "ie", + "il", + "im", + "in", + "iq", + "ir", + "is", + "it", + "je", + "jm", + "jo", + "jp", + "ke", + "kg", + "kh", + "kn", + "kr", + "kw", + "ky", + "kz", + "la", + "lb", + "lc", + "lk", + "lr", + "ls", + "lt", + "lu", + "lv", + "ly", + "ma", + "mc", + "md", + "me", + "mf", + "mg", + "mk", + "ml", + "mm", + "mn", + "mo", + "mq", + "mr", + "mt", + "mu", + "mv", + "mw", + "mx", + "my", + "mz", + "na", + "nc", + "ne", + "ng", + "ni", + "nl", + "no", + "np", + "nz", + "om", + "pa", + "pe", + "pf", + "pg", + "ph", + "pk", + "pl", + "pr", + "ps", + "pt", + "py", + "qa", + "re", + "ro", + "rs", + "ru", + "rw", + "sa", + "sc", + "sd", + "se", + "sg", + "si", + "sk", + "sl", + "sm", + "sn", + "so", + "sr", + "ss", + "st", + "sv", + "sx", + "sy", + "sz", + "tc", + "td", + "tg", + "th", + "tj", + "tl", + "tm", + "tn", + "tr", + "tt", + "tw", + "tz", + "ua", + "ug", + "us", + "uy", + "uz", + "vc", + "ve", + "vg", + "vi", + "vn", + "ye", + "yt", + "za", + "zm", + "zw", + ] + | Omit = omit, direct_url: str | Omit = omit, domain: str | Omit = omit, full_screenshot: Literal["true", "false"] | Omit = omit, @@ -1301,6 +2620,12 @@ async def screenshot( Capture a screenshot of a website. Args: + color_scheme: Optional parameter to choose the site's visual theme in the screenshot. Use + 'light' or 'dark' when the site offers both appearances. + + country: Two-letter ISO 3166-1 alpha-2 country code for the website request location. + When provided, Context.dev fetches the target page from that country. + direct_url: A specific URL to screenshot directly, bypassing domain resolution (e.g., 'https://example.com/pricing'). When provided, the screenshot is taken of this exact URL. You must provide either 'domain' or 'directUrl', but not both. @@ -1361,6 +2686,8 @@ async def screenshot( timeout=timeout, query=await async_maybe_transform( { + "color_scheme": color_scheme, + "country": country, "direct_url": direct_url, "domain": domain, "full_screenshot": full_screenshot, @@ -1382,10 +2709,253 @@ async def search( self, *, query: str, + country: Literal[ + "af", + "al", + "dz", + "as", + "ad", + "ao", + "ai", + "aq", + "ag", + "ar", + "am", + "aw", + "au", + "at", + "az", + "bs", + "bh", + "bd", + "bb", + "by", + "be", + "bz", + "bj", + "bm", + "bt", + "bo", + "ba", + "bw", + "bv", + "br", + "io", + "bn", + "bg", + "bf", + "bi", + "kh", + "cm", + "ca", + "cv", + "ky", + "cf", + "td", + "cl", + "cn", + "cx", + "cc", + "co", + "km", + "cg", + "cd", + "ck", + "cr", + "ci", + "hr", + "cu", + "cy", + "cz", + "dk", + "dj", + "dm", + "do", + "ec", + "eg", + "sv", + "gq", + "er", + "ee", + "et", + "fk", + "fo", + "fj", + "fi", + "fr", + "gf", + "pf", + "tf", + "ga", + "gm", + "ge", + "de", + "gh", + "gi", + "gr", + "gl", + "gd", + "gp", + "gu", + "gt", + "gn", + "gw", + "gy", + "ht", + "hm", + "va", + "hn", + "hk", + "hu", + "is", + "in", + "id", + "ir", + "iq", + "ie", + "il", + "it", + "jm", + "jp", + "jo", + "kz", + "ke", + "ki", + "kp", + "kr", + "kw", + "kg", + "la", + "lv", + "lb", + "ls", + "lr", + "ly", + "li", + "lt", + "lu", + "mo", + "mk", + "mg", + "mw", + "my", + "mv", + "ml", + "mt", + "mh", + "mq", + "mr", + "mu", + "yt", + "mx", + "fm", + "md", + "mc", + "mn", + "ms", + "ma", + "mz", + "mm", + "na", + "nr", + "np", + "nl", + "an", + "nc", + "nz", + "ni", + "ne", + "ng", + "nu", + "nf", + "mp", + "no", + "om", + "pk", + "pw", + "ps", + "pa", + "pg", + "py", + "pe", + "ph", + "pn", + "pl", + "pt", + "pr", + "qa", + "re", + "ro", + "ru", + "rw", + "sh", + "kn", + "lc", + "pm", + "vc", + "ws", + "sm", + "st", + "sa", + "sn", + "rs", + "sc", + "sl", + "sg", + "sk", + "si", + "sb", + "so", + "za", + "gs", + "es", + "lk", + "sd", + "sr", + "sj", + "sz", + "se", + "ch", + "sy", + "tw", + "tj", + "tz", + "th", + "tl", + "tg", + "tk", + "to", + "tt", + "tn", + "tr", + "tm", + "tc", + "tv", + "ug", + "ua", + "ae", + "gb", + "us", + "um", + "uy", + "uz", + "vu", + "ve", + "vn", + "vg", + "vi", + "wf", + "eh", + "ye", + "zm", + "zw", + ] + | Omit = omit, exclude_domains: SequenceNotStr[str] | Omit = omit, freshness: Literal["last_24_hours", "last_week", "last_month", "last_year"] | Omit = omit, include_domains: SequenceNotStr[str] | Omit = omit, markdown_options: web_search_params.MarkdownOptions | Omit = omit, + num_results: int | Omit = omit, query_fanout: bool | Omit = omit, timeout_ms: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -1399,7 +2969,11 @@ async def search( Search the web and optionally scrape each result to Markdown in one round-trip. Args: - query: Natural-language search query. + query: Search query. Accepts natural language as well as Google-style search operators + such as `site:`, `-site:`, `inurl:`, `intitle:`, quoted phrases, and `OR`. + + country: Two-letter ISO 3166-1 alpha-2 country code to localize results to a specific + country (maps to Google's `gl` parameter). Example: "us", "gb", "de". exclude_domains: Blocklist — drop results from these domains. Example: ["pinterest.com", "reddit.com"]. @@ -1411,6 +2985,8 @@ async def search( markdown_options: Inline Markdown scraping for each result. Set `enabled: true` to activate. + num_results: Number of results to request and return (10–100). Defaults to 10. + query_fanout: Expand the query into multiple parallel variants for broader recall. timeout_ms: Optional timeout in milliseconds for the request. If the request takes longer @@ -1430,10 +3006,12 @@ async def search( body=await async_maybe_transform( { "query": query, + "country": country, "exclude_domains": exclude_domains, "freshness": freshness, "include_domains": include_domains, "markdown_options": markdown_options, + "num_results": num_results, "query_fanout": query_fanout, "timeout_ms": timeout_ms, }, @@ -1449,6 +3027,213 @@ async def web_crawl_md( self, *, url: str, + country: Literal[ + "ad", + "ae", + "af", + "ag", + "ai", + "al", + "am", + "ao", + "ar", + "at", + "au", + "aw", + "az", + "ba", + "bb", + "bd", + "be", + "bf", + "bg", + "bh", + "bi", + "bj", + "bm", + "bn", + "bo", + "bq", + "br", + "bs", + "bw", + "by", + "bz", + "ca", + "cd", + "cf", + "cg", + "ch", + "ci", + "cl", + "cm", + "cn", + "co", + "cr", + "cv", + "cw", + "cy", + "cz", + "de", + "dj", + "dk", + "dm", + "do", + "dz", + "ec", + "ee", + "eg", + "es", + "et", + "fi", + "fj", + "fr", + "ga", + "gb", + "gd", + "ge", + "gf", + "gg", + "gh", + "gm", + "gn", + "gp", + "gq", + "gr", + "gt", + "gu", + "gw", + "gy", + "hk", + "hn", + "hr", + "ht", + "hu", + "id", + "ie", + "il", + "im", + "in", + "iq", + "ir", + "is", + "it", + "je", + "jm", + "jo", + "jp", + "ke", + "kg", + "kh", + "kn", + "kr", + "kw", + "ky", + "kz", + "la", + "lb", + "lc", + "lk", + "lr", + "ls", + "lt", + "lu", + "lv", + "ly", + "ma", + "mc", + "md", + "me", + "mf", + "mg", + "mk", + "ml", + "mm", + "mn", + "mo", + "mq", + "mr", + "mt", + "mu", + "mv", + "mw", + "mx", + "my", + "mz", + "na", + "nc", + "ne", + "ng", + "ni", + "nl", + "no", + "np", + "nz", + "om", + "pa", + "pe", + "pf", + "pg", + "ph", + "pk", + "pl", + "pr", + "ps", + "pt", + "py", + "qa", + "re", + "ro", + "rs", + "ru", + "rw", + "sa", + "sc", + "sd", + "se", + "sg", + "si", + "sk", + "sl", + "sm", + "sn", + "so", + "sr", + "ss", + "st", + "sv", + "sx", + "sy", + "sz", + "tc", + "td", + "tg", + "th", + "tj", + "tl", + "tm", + "tn", + "tr", + "tt", + "tw", + "tz", + "ua", + "ug", + "us", + "uy", + "uz", + "vc", + "ve", + "vg", + "vi", + "vn", + "ye", + "yt", + "za", + "zm", + "zw", + ] + | Omit = omit, exclude_selectors: SequenceNotStr[str] | Omit = omit, follow_subdomains: bool | Omit = omit, include_frames: bool | Omit = omit, @@ -1479,6 +3264,10 @@ async def web_crawl_md( Args: url: The starting URL for the crawl (must include http:// or https:// protocol) + country: Two-letter ISO 3166-1 alpha-2 country code identifying a supported Context.dev + residential proxy exit location. Must be one of Context.dev's supported + countries. When provided, Context.dev fetches the target page from that country. + exclude_selectors: CSS selectors to remove before each crawled page is converted to Markdown. Applied after includeSelectors. Exclusion takes precedence: an element matching both is removed. Examples: "nav", "footer", ".ad-banner", "[aria-hidden=true]". @@ -1542,6 +3331,7 @@ async def web_crawl_md( body=await async_maybe_transform( { "url": url, + "country": country, "exclude_selectors": exclude_selectors, "follow_subdomains": follow_subdomains, "include_frames": include_frames, @@ -1571,6 +3361,213 @@ async def web_scrape_html( self, *, url: str, + country: Literal[ + "ad", + "ae", + "af", + "ag", + "ai", + "al", + "am", + "ao", + "ar", + "at", + "au", + "aw", + "az", + "ba", + "bb", + "bd", + "be", + "bf", + "bg", + "bh", + "bi", + "bj", + "bm", + "bn", + "bo", + "bq", + "br", + "bs", + "bw", + "by", + "bz", + "ca", + "cd", + "cf", + "cg", + "ch", + "ci", + "cl", + "cm", + "cn", + "co", + "cr", + "cv", + "cw", + "cy", + "cz", + "de", + "dj", + "dk", + "dm", + "do", + "dz", + "ec", + "ee", + "eg", + "es", + "et", + "fi", + "fj", + "fr", + "ga", + "gb", + "gd", + "ge", + "gf", + "gg", + "gh", + "gm", + "gn", + "gp", + "gq", + "gr", + "gt", + "gu", + "gw", + "gy", + "hk", + "hn", + "hr", + "ht", + "hu", + "id", + "ie", + "il", + "im", + "in", + "iq", + "ir", + "is", + "it", + "je", + "jm", + "jo", + "jp", + "ke", + "kg", + "kh", + "kn", + "kr", + "kw", + "ky", + "kz", + "la", + "lb", + "lc", + "lk", + "lr", + "ls", + "lt", + "lu", + "lv", + "ly", + "ma", + "mc", + "md", + "me", + "mf", + "mg", + "mk", + "ml", + "mm", + "mn", + "mo", + "mq", + "mr", + "mt", + "mu", + "mv", + "mw", + "mx", + "my", + "mz", + "na", + "nc", + "ne", + "ng", + "ni", + "nl", + "no", + "np", + "nz", + "om", + "pa", + "pe", + "pf", + "pg", + "ph", + "pk", + "pl", + "pr", + "ps", + "pt", + "py", + "qa", + "re", + "ro", + "rs", + "ru", + "rw", + "sa", + "sc", + "sd", + "se", + "sg", + "si", + "sk", + "sl", + "sm", + "sn", + "so", + "sr", + "ss", + "st", + "sv", + "sx", + "sy", + "sz", + "tc", + "td", + "tg", + "th", + "tj", + "tl", + "tm", + "tn", + "tr", + "tt", + "tw", + "tz", + "ua", + "ug", + "us", + "uy", + "uz", + "vc", + "ve", + "vg", + "vi", + "vn", + "ye", + "yt", + "za", + "zm", + "zw", + ] + | Omit = omit, exclude_selectors: SequenceNotStr[str] | Omit = omit, headers: Dict[str, str] | Omit = omit, include_frames: bool | Omit = omit, @@ -1593,6 +3590,9 @@ async def web_scrape_html( Args: url: Full URL to scrape (must include http:// or https:// protocol) + country: Two-letter ISO 3166-1 alpha-2 country code for the website request location. + When provided, Context.dev fetches the target page from that country. + exclude_selectors: CSS selectors to remove from the result. Applied after includeSelectors. Exclusion takes precedence: an element matching both is removed. Examples: "nav", "footer", ".ad-banner", "[aria-hidden=true]". @@ -1643,6 +3643,7 @@ async def web_scrape_html( query=await async_maybe_transform( { "url": url, + "country": country, "exclude_selectors": exclude_selectors, "headers": headers, "include_frames": include_frames, @@ -1735,6 +3736,213 @@ async def web_scrape_md( self, *, url: str, + country: Literal[ + "ad", + "ae", + "af", + "ag", + "ai", + "al", + "am", + "ao", + "ar", + "at", + "au", + "aw", + "az", + "ba", + "bb", + "bd", + "be", + "bf", + "bg", + "bh", + "bi", + "bj", + "bm", + "bn", + "bo", + "bq", + "br", + "bs", + "bw", + "by", + "bz", + "ca", + "cd", + "cf", + "cg", + "ch", + "ci", + "cl", + "cm", + "cn", + "co", + "cr", + "cv", + "cw", + "cy", + "cz", + "de", + "dj", + "dk", + "dm", + "do", + "dz", + "ec", + "ee", + "eg", + "es", + "et", + "fi", + "fj", + "fr", + "ga", + "gb", + "gd", + "ge", + "gf", + "gg", + "gh", + "gm", + "gn", + "gp", + "gq", + "gr", + "gt", + "gu", + "gw", + "gy", + "hk", + "hn", + "hr", + "ht", + "hu", + "id", + "ie", + "il", + "im", + "in", + "iq", + "ir", + "is", + "it", + "je", + "jm", + "jo", + "jp", + "ke", + "kg", + "kh", + "kn", + "kr", + "kw", + "ky", + "kz", + "la", + "lb", + "lc", + "lk", + "lr", + "ls", + "lt", + "lu", + "lv", + "ly", + "ma", + "mc", + "md", + "me", + "mf", + "mg", + "mk", + "ml", + "mm", + "mn", + "mo", + "mq", + "mr", + "mt", + "mu", + "mv", + "mw", + "mx", + "my", + "mz", + "na", + "nc", + "ne", + "ng", + "ni", + "nl", + "no", + "np", + "nz", + "om", + "pa", + "pe", + "pf", + "pg", + "ph", + "pk", + "pl", + "pr", + "ps", + "pt", + "py", + "qa", + "re", + "ro", + "rs", + "ru", + "rw", + "sa", + "sc", + "sd", + "se", + "sg", + "si", + "sk", + "sl", + "sm", + "sn", + "so", + "sr", + "ss", + "st", + "sv", + "sx", + "sy", + "sz", + "tc", + "td", + "tg", + "th", + "tj", + "tl", + "tm", + "tn", + "tr", + "tt", + "tw", + "tz", + "ua", + "ug", + "us", + "uy", + "uz", + "vc", + "ve", + "vg", + "vi", + "vn", + "ye", + "yt", + "za", + "zm", + "zw", + ] + | Omit = omit, exclude_selectors: SequenceNotStr[str] | Omit = omit, headers: Dict[str, str] | Omit = omit, include_frames: bool | Omit = omit, @@ -1761,6 +3969,9 @@ async def web_scrape_md( url: Full URL to scrape into LLM usable Markdown (must include http:// or https:// protocol) + country: Two-letter ISO 3166-1 alpha-2 country code for the website request location. + When provided, Context.dev fetches the target page from that country. + exclude_selectors: CSS selectors to remove before conversion to Markdown. Applied after includeSelectors. Exclusion takes precedence: an element matching both is removed. Examples: "nav", "footer", ".ad-banner", "[aria-hidden=true]". @@ -1816,6 +4027,7 @@ async def web_scrape_md( query=await async_maybe_transform( { "url": url, + "country": country, "exclude_selectors": exclude_selectors, "headers": headers, "include_frames": include_frames, diff --git a/src/context/dev/types/web_extract_styleguide_params.py b/src/context/dev/types/web_extract_styleguide_params.py index 3ccd09f..6f32efe 100644 --- a/src/context/dev/types/web_extract_styleguide_params.py +++ b/src/context/dev/types/web_extract_styleguide_params.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing_extensions import Annotated, TypedDict +from typing_extensions import Literal, Annotated, TypedDict from .._utils import PropertyInfo @@ -10,6 +10,12 @@ class WebExtractStyleguideParams(TypedDict, total=False): + color_scheme: Annotated[Literal["light", "dark"], PropertyInfo(alias="colorScheme")] + """ + Optional browser color scheme to emulate for websites that respond to + prefers-color-scheme. This value is part of the styleguide cache key. + """ + direct_url: Annotated[str, PropertyInfo(alias="directUrl")] """ A specific URL to fetch the styleguide from directly, bypassing domain diff --git a/src/context/dev/types/web_screenshot_params.py b/src/context/dev/types/web_screenshot_params.py index fc01822..122c095 100644 --- a/src/context/dev/types/web_screenshot_params.py +++ b/src/context/dev/types/web_screenshot_params.py @@ -10,6 +10,223 @@ class WebScreenshotParams(TypedDict, total=False): + color_scheme: Annotated[Literal["light", "dark"], PropertyInfo(alias="colorScheme")] + """Optional parameter to choose the site's visual theme in the screenshot. + + Use 'light' or 'dark' when the site offers both appearances. + """ + + country: Literal[ + "ad", + "ae", + "af", + "ag", + "ai", + "al", + "am", + "ao", + "ar", + "at", + "au", + "aw", + "az", + "ba", + "bb", + "bd", + "be", + "bf", + "bg", + "bh", + "bi", + "bj", + "bm", + "bn", + "bo", + "bq", + "br", + "bs", + "bw", + "by", + "bz", + "ca", + "cd", + "cf", + "cg", + "ch", + "ci", + "cl", + "cm", + "cn", + "co", + "cr", + "cv", + "cw", + "cy", + "cz", + "de", + "dj", + "dk", + "dm", + "do", + "dz", + "ec", + "ee", + "eg", + "es", + "et", + "fi", + "fj", + "fr", + "ga", + "gb", + "gd", + "ge", + "gf", + "gg", + "gh", + "gm", + "gn", + "gp", + "gq", + "gr", + "gt", + "gu", + "gw", + "gy", + "hk", + "hn", + "hr", + "ht", + "hu", + "id", + "ie", + "il", + "im", + "in", + "iq", + "ir", + "is", + "it", + "je", + "jm", + "jo", + "jp", + "ke", + "kg", + "kh", + "kn", + "kr", + "kw", + "ky", + "kz", + "la", + "lb", + "lc", + "lk", + "lr", + "ls", + "lt", + "lu", + "lv", + "ly", + "ma", + "mc", + "md", + "me", + "mf", + "mg", + "mk", + "ml", + "mm", + "mn", + "mo", + "mq", + "mr", + "mt", + "mu", + "mv", + "mw", + "mx", + "my", + "mz", + "na", + "nc", + "ne", + "ng", + "ni", + "nl", + "no", + "np", + "nz", + "om", + "pa", + "pe", + "pf", + "pg", + "ph", + "pk", + "pl", + "pr", + "ps", + "pt", + "py", + "qa", + "re", + "ro", + "rs", + "ru", + "rw", + "sa", + "sc", + "sd", + "se", + "sg", + "si", + "sk", + "sl", + "sm", + "sn", + "so", + "sr", + "ss", + "st", + "sv", + "sx", + "sy", + "sz", + "tc", + "td", + "tg", + "th", + "tj", + "tl", + "tm", + "tn", + "tr", + "tt", + "tw", + "tz", + "ua", + "ug", + "us", + "uy", + "uz", + "vc", + "ve", + "vg", + "vi", + "vn", + "ye", + "yt", + "za", + "zm", + "zw", + ] + """Two-letter ISO 3166-1 alpha-2 country code for the website request location. + + When provided, Context.dev fetches the target page from that country. + """ + direct_url: Annotated[str, PropertyInfo(alias="directUrl")] """ A specific URL to screenshot directly, bypassing domain resolution (e.g., diff --git a/src/context/dev/types/web_search_params.py b/src/context/dev/types/web_search_params.py index 5c3e89f..dc38ced 100644 --- a/src/context/dev/types/web_search_params.py +++ b/src/context/dev/types/web_search_params.py @@ -12,7 +12,257 @@ class WebSearchParams(TypedDict, total=False): query: Required[str] - """Natural-language search query.""" + """Search query. + + Accepts natural language as well as Google-style search operators such as + `site:`, `-site:`, `inurl:`, `intitle:`, quoted phrases, and `OR`. + """ + + country: Literal[ + "af", + "al", + "dz", + "as", + "ad", + "ao", + "ai", + "aq", + "ag", + "ar", + "am", + "aw", + "au", + "at", + "az", + "bs", + "bh", + "bd", + "bb", + "by", + "be", + "bz", + "bj", + "bm", + "bt", + "bo", + "ba", + "bw", + "bv", + "br", + "io", + "bn", + "bg", + "bf", + "bi", + "kh", + "cm", + "ca", + "cv", + "ky", + "cf", + "td", + "cl", + "cn", + "cx", + "cc", + "co", + "km", + "cg", + "cd", + "ck", + "cr", + "ci", + "hr", + "cu", + "cy", + "cz", + "dk", + "dj", + "dm", + "do", + "ec", + "eg", + "sv", + "gq", + "er", + "ee", + "et", + "fk", + "fo", + "fj", + "fi", + "fr", + "gf", + "pf", + "tf", + "ga", + "gm", + "ge", + "de", + "gh", + "gi", + "gr", + "gl", + "gd", + "gp", + "gu", + "gt", + "gn", + "gw", + "gy", + "ht", + "hm", + "va", + "hn", + "hk", + "hu", + "is", + "in", + "id", + "ir", + "iq", + "ie", + "il", + "it", + "jm", + "jp", + "jo", + "kz", + "ke", + "ki", + "kp", + "kr", + "kw", + "kg", + "la", + "lv", + "lb", + "ls", + "lr", + "ly", + "li", + "lt", + "lu", + "mo", + "mk", + "mg", + "mw", + "my", + "mv", + "ml", + "mt", + "mh", + "mq", + "mr", + "mu", + "yt", + "mx", + "fm", + "md", + "mc", + "mn", + "ms", + "ma", + "mz", + "mm", + "na", + "nr", + "np", + "nl", + "an", + "nc", + "nz", + "ni", + "ne", + "ng", + "nu", + "nf", + "mp", + "no", + "om", + "pk", + "pw", + "ps", + "pa", + "pg", + "py", + "pe", + "ph", + "pn", + "pl", + "pt", + "pr", + "qa", + "re", + "ro", + "ru", + "rw", + "sh", + "kn", + "lc", + "pm", + "vc", + "ws", + "sm", + "st", + "sa", + "sn", + "rs", + "sc", + "sl", + "sg", + "sk", + "si", + "sb", + "so", + "za", + "gs", + "es", + "lk", + "sd", + "sr", + "sj", + "sz", + "se", + "ch", + "sy", + "tw", + "tj", + "tz", + "th", + "tl", + "tg", + "tk", + "to", + "tt", + "tn", + "tr", + "tm", + "tc", + "tv", + "ug", + "ua", + "ae", + "gb", + "us", + "um", + "uy", + "uz", + "vu", + "ve", + "vn", + "vg", + "vi", + "wf", + "eh", + "ye", + "zm", + "zw", + ] + """ + Two-letter ISO 3166-1 alpha-2 country code to localize results to a specific + country (maps to Google's `gl` parameter). Example: "us", "gb", "de". + """ exclude_domains: Annotated[SequenceNotStr[str], PropertyInfo(alias="excludeDomains")] """Blocklist — drop results from these domains. @@ -32,6 +282,9 @@ class WebSearchParams(TypedDict, total=False): markdown_options: Annotated[MarkdownOptions, PropertyInfo(alias="markdownOptions")] """Inline Markdown scraping for each result. Set `enabled: true` to activate.""" + num_results: Annotated[int, PropertyInfo(alias="numResults")] + """Number of results to request and return (10–100). Defaults to 10.""" + query_fanout: Annotated[bool, PropertyInfo(alias="queryFanout")] """Expand the query into multiple parallel variants for broader recall.""" diff --git a/src/context/dev/types/web_web_crawl_md_params.py b/src/context/dev/types/web_web_crawl_md_params.py index 9ad3782..f71309f 100644 --- a/src/context/dev/types/web_web_crawl_md_params.py +++ b/src/context/dev/types/web_web_crawl_md_params.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing_extensions import Required, Annotated, TypedDict +from typing_extensions import Literal, Required, Annotated, TypedDict from .._types import SequenceNotStr from .._utils import PropertyInfo @@ -14,6 +14,218 @@ class WebWebCrawlMdParams(TypedDict, total=False): url: Required[str] """The starting URL for the crawl (must include http:// or https:// protocol)""" + country: Literal[ + "ad", + "ae", + "af", + "ag", + "ai", + "al", + "am", + "ao", + "ar", + "at", + "au", + "aw", + "az", + "ba", + "bb", + "bd", + "be", + "bf", + "bg", + "bh", + "bi", + "bj", + "bm", + "bn", + "bo", + "bq", + "br", + "bs", + "bw", + "by", + "bz", + "ca", + "cd", + "cf", + "cg", + "ch", + "ci", + "cl", + "cm", + "cn", + "co", + "cr", + "cv", + "cw", + "cy", + "cz", + "de", + "dj", + "dk", + "dm", + "do", + "dz", + "ec", + "ee", + "eg", + "es", + "et", + "fi", + "fj", + "fr", + "ga", + "gb", + "gd", + "ge", + "gf", + "gg", + "gh", + "gm", + "gn", + "gp", + "gq", + "gr", + "gt", + "gu", + "gw", + "gy", + "hk", + "hn", + "hr", + "ht", + "hu", + "id", + "ie", + "il", + "im", + "in", + "iq", + "ir", + "is", + "it", + "je", + "jm", + "jo", + "jp", + "ke", + "kg", + "kh", + "kn", + "kr", + "kw", + "ky", + "kz", + "la", + "lb", + "lc", + "lk", + "lr", + "ls", + "lt", + "lu", + "lv", + "ly", + "ma", + "mc", + "md", + "me", + "mf", + "mg", + "mk", + "ml", + "mm", + "mn", + "mo", + "mq", + "mr", + "mt", + "mu", + "mv", + "mw", + "mx", + "my", + "mz", + "na", + "nc", + "ne", + "ng", + "ni", + "nl", + "no", + "np", + "nz", + "om", + "pa", + "pe", + "pf", + "pg", + "ph", + "pk", + "pl", + "pr", + "ps", + "pt", + "py", + "qa", + "re", + "ro", + "rs", + "ru", + "rw", + "sa", + "sc", + "sd", + "se", + "sg", + "si", + "sk", + "sl", + "sm", + "sn", + "so", + "sr", + "ss", + "st", + "sv", + "sx", + "sy", + "sz", + "tc", + "td", + "tg", + "th", + "tj", + "tl", + "tm", + "tn", + "tr", + "tt", + "tw", + "tz", + "ua", + "ug", + "us", + "uy", + "uz", + "vc", + "ve", + "vg", + "vi", + "vn", + "ye", + "yt", + "za", + "zm", + "zw", + ] + """ + Two-letter ISO 3166-1 alpha-2 country code identifying a supported Context.dev + residential proxy exit location. Must be one of Context.dev's supported + countries. When provided, Context.dev fetches the target page from that country. + """ + exclude_selectors: Annotated[SequenceNotStr[str], PropertyInfo(alias="excludeSelectors")] """CSS selectors to remove before each crawled page is converted to Markdown. diff --git a/src/context/dev/types/web_web_scrape_html_params.py b/src/context/dev/types/web_web_scrape_html_params.py index 9a61705..20a6ec9 100644 --- a/src/context/dev/types/web_web_scrape_html_params.py +++ b/src/context/dev/types/web_web_scrape_html_params.py @@ -3,7 +3,7 @@ from __future__ import annotations from typing import Dict -from typing_extensions import Required, Annotated, TypedDict +from typing_extensions import Literal, Required, Annotated, TypedDict from .._types import SequenceNotStr from .._utils import PropertyInfo @@ -15,6 +15,217 @@ class WebWebScrapeHTMLParams(TypedDict, total=False): url: Required[str] """Full URL to scrape (must include http:// or https:// protocol)""" + country: Literal[ + "ad", + "ae", + "af", + "ag", + "ai", + "al", + "am", + "ao", + "ar", + "at", + "au", + "aw", + "az", + "ba", + "bb", + "bd", + "be", + "bf", + "bg", + "bh", + "bi", + "bj", + "bm", + "bn", + "bo", + "bq", + "br", + "bs", + "bw", + "by", + "bz", + "ca", + "cd", + "cf", + "cg", + "ch", + "ci", + "cl", + "cm", + "cn", + "co", + "cr", + "cv", + "cw", + "cy", + "cz", + "de", + "dj", + "dk", + "dm", + "do", + "dz", + "ec", + "ee", + "eg", + "es", + "et", + "fi", + "fj", + "fr", + "ga", + "gb", + "gd", + "ge", + "gf", + "gg", + "gh", + "gm", + "gn", + "gp", + "gq", + "gr", + "gt", + "gu", + "gw", + "gy", + "hk", + "hn", + "hr", + "ht", + "hu", + "id", + "ie", + "il", + "im", + "in", + "iq", + "ir", + "is", + "it", + "je", + "jm", + "jo", + "jp", + "ke", + "kg", + "kh", + "kn", + "kr", + "kw", + "ky", + "kz", + "la", + "lb", + "lc", + "lk", + "lr", + "ls", + "lt", + "lu", + "lv", + "ly", + "ma", + "mc", + "md", + "me", + "mf", + "mg", + "mk", + "ml", + "mm", + "mn", + "mo", + "mq", + "mr", + "mt", + "mu", + "mv", + "mw", + "mx", + "my", + "mz", + "na", + "nc", + "ne", + "ng", + "ni", + "nl", + "no", + "np", + "nz", + "om", + "pa", + "pe", + "pf", + "pg", + "ph", + "pk", + "pl", + "pr", + "ps", + "pt", + "py", + "qa", + "re", + "ro", + "rs", + "ru", + "rw", + "sa", + "sc", + "sd", + "se", + "sg", + "si", + "sk", + "sl", + "sm", + "sn", + "so", + "sr", + "ss", + "st", + "sv", + "sx", + "sy", + "sz", + "tc", + "td", + "tg", + "th", + "tj", + "tl", + "tm", + "tn", + "tr", + "tt", + "tw", + "tz", + "ua", + "ug", + "us", + "uy", + "uz", + "vc", + "ve", + "vg", + "vi", + "vn", + "ye", + "yt", + "za", + "zm", + "zw", + ] + """Two-letter ISO 3166-1 alpha-2 country code for the website request location. + + When provided, Context.dev fetches the target page from that country. + """ + exclude_selectors: Annotated[SequenceNotStr[str], PropertyInfo(alias="excludeSelectors")] """CSS selectors to remove from the result. diff --git a/src/context/dev/types/web_web_scrape_md_params.py b/src/context/dev/types/web_web_scrape_md_params.py index d70b458..0bb7b3a 100644 --- a/src/context/dev/types/web_web_scrape_md_params.py +++ b/src/context/dev/types/web_web_scrape_md_params.py @@ -3,7 +3,7 @@ from __future__ import annotations from typing import Dict -from typing_extensions import Required, Annotated, TypedDict +from typing_extensions import Literal, Required, Annotated, TypedDict from .._types import SequenceNotStr from .._utils import PropertyInfo @@ -18,6 +18,217 @@ class WebWebScrapeMdParams(TypedDict, total=False): protocol) """ + country: Literal[ + "ad", + "ae", + "af", + "ag", + "ai", + "al", + "am", + "ao", + "ar", + "at", + "au", + "aw", + "az", + "ba", + "bb", + "bd", + "be", + "bf", + "bg", + "bh", + "bi", + "bj", + "bm", + "bn", + "bo", + "bq", + "br", + "bs", + "bw", + "by", + "bz", + "ca", + "cd", + "cf", + "cg", + "ch", + "ci", + "cl", + "cm", + "cn", + "co", + "cr", + "cv", + "cw", + "cy", + "cz", + "de", + "dj", + "dk", + "dm", + "do", + "dz", + "ec", + "ee", + "eg", + "es", + "et", + "fi", + "fj", + "fr", + "ga", + "gb", + "gd", + "ge", + "gf", + "gg", + "gh", + "gm", + "gn", + "gp", + "gq", + "gr", + "gt", + "gu", + "gw", + "gy", + "hk", + "hn", + "hr", + "ht", + "hu", + "id", + "ie", + "il", + "im", + "in", + "iq", + "ir", + "is", + "it", + "je", + "jm", + "jo", + "jp", + "ke", + "kg", + "kh", + "kn", + "kr", + "kw", + "ky", + "kz", + "la", + "lb", + "lc", + "lk", + "lr", + "ls", + "lt", + "lu", + "lv", + "ly", + "ma", + "mc", + "md", + "me", + "mf", + "mg", + "mk", + "ml", + "mm", + "mn", + "mo", + "mq", + "mr", + "mt", + "mu", + "mv", + "mw", + "mx", + "my", + "mz", + "na", + "nc", + "ne", + "ng", + "ni", + "nl", + "no", + "np", + "nz", + "om", + "pa", + "pe", + "pf", + "pg", + "ph", + "pk", + "pl", + "pr", + "ps", + "pt", + "py", + "qa", + "re", + "ro", + "rs", + "ru", + "rw", + "sa", + "sc", + "sd", + "se", + "sg", + "si", + "sk", + "sl", + "sm", + "sn", + "so", + "sr", + "ss", + "st", + "sv", + "sx", + "sy", + "sz", + "tc", + "td", + "tg", + "th", + "tj", + "tl", + "tm", + "tn", + "tr", + "tt", + "tw", + "tz", + "ua", + "ug", + "us", + "uy", + "uz", + "vc", + "ve", + "vg", + "vi", + "vn", + "ye", + "yt", + "za", + "zm", + "zw", + ] + """Two-letter ISO 3166-1 alpha-2 country code for the website request location. + + When provided, Context.dev fetches the target page from that country. + """ + exclude_selectors: Annotated[SequenceNotStr[str], PropertyInfo(alias="excludeSelectors")] """CSS selectors to remove before conversion to Markdown. diff --git a/tests/api_resources/test_web.py b/tests/api_resources/test_web.py index 60f8e9f..407af5e 100644 --- a/tests/api_resources/test_web.py +++ b/tests/api_resources/test_web.py @@ -203,6 +203,7 @@ def test_method_extract_styleguide(self, client: ContextDev) -> None: @parametrize def test_method_extract_styleguide_with_all_params(self, client: ContextDev) -> None: web = client.web.extract_styleguide( + color_scheme="light", direct_url="https://example.com", domain="domain", max_age_ms=86400000, @@ -242,6 +243,8 @@ def test_method_screenshot(self, client: ContextDev) -> None: @parametrize def test_method_screenshot_with_all_params(self, client: ContextDev) -> None: web = client.web.screenshot( + color_scheme="light", + country="de", direct_url="https://example.com", domain="domain", full_screenshot="true", @@ -293,6 +296,7 @@ def test_method_search(self, client: ContextDev) -> None: def test_method_search_with_all_params(self, client: ContextDev) -> None: web = client.web.search( query="x", + country="af", exclude_domains=["string"], freshness="last_24_hours", include_domains=["string"], @@ -312,6 +316,7 @@ def test_method_search_with_all_params(self, client: ContextDev) -> None: "use_main_content_only": True, "wait_for_ms": 0, }, + num_results=10, query_fanout=True, timeout_ms=1000, ) @@ -356,6 +361,7 @@ def test_method_web_crawl_md(self, client: ContextDev) -> None: def test_method_web_crawl_md_with_all_params(self, client: ContextDev) -> None: web = client.web.web_crawl_md( url="https://example.com", + country="de", exclude_selectors=["string"], follow_subdomains=True, include_frames=True, @@ -418,6 +424,7 @@ def test_method_web_scrape_html(self, client: ContextDev) -> None: def test_method_web_scrape_html_with_all_params(self, client: ContextDev) -> None: web = client.web.web_scrape_html( url="https://example.com", + country="de", exclude_selectors=["string"], headers={"foo": "J!"}, include_frames=True, @@ -525,6 +532,7 @@ def test_method_web_scrape_md(self, client: ContextDev) -> None: def test_method_web_scrape_md_with_all_params(self, client: ContextDev) -> None: web = client.web.web_scrape_md( url="https://example.com", + country="de", exclude_selectors=["string"], headers={"foo": "J!"}, include_frames=True, @@ -796,6 +804,7 @@ async def test_method_extract_styleguide(self, async_client: AsyncContextDev) -> @parametrize async def test_method_extract_styleguide_with_all_params(self, async_client: AsyncContextDev) -> None: web = await async_client.web.extract_styleguide( + color_scheme="light", direct_url="https://example.com", domain="domain", max_age_ms=86400000, @@ -835,6 +844,8 @@ async def test_method_screenshot(self, async_client: AsyncContextDev) -> None: @parametrize async def test_method_screenshot_with_all_params(self, async_client: AsyncContextDev) -> None: web = await async_client.web.screenshot( + color_scheme="light", + country="de", direct_url="https://example.com", domain="domain", full_screenshot="true", @@ -886,6 +897,7 @@ async def test_method_search(self, async_client: AsyncContextDev) -> None: async def test_method_search_with_all_params(self, async_client: AsyncContextDev) -> None: web = await async_client.web.search( query="x", + country="af", exclude_domains=["string"], freshness="last_24_hours", include_domains=["string"], @@ -905,6 +917,7 @@ async def test_method_search_with_all_params(self, async_client: AsyncContextDev "use_main_content_only": True, "wait_for_ms": 0, }, + num_results=10, query_fanout=True, timeout_ms=1000, ) @@ -949,6 +962,7 @@ async def test_method_web_crawl_md(self, async_client: AsyncContextDev) -> None: async def test_method_web_crawl_md_with_all_params(self, async_client: AsyncContextDev) -> None: web = await async_client.web.web_crawl_md( url="https://example.com", + country="de", exclude_selectors=["string"], follow_subdomains=True, include_frames=True, @@ -1011,6 +1025,7 @@ async def test_method_web_scrape_html(self, async_client: AsyncContextDev) -> No async def test_method_web_scrape_html_with_all_params(self, async_client: AsyncContextDev) -> None: web = await async_client.web.web_scrape_html( url="https://example.com", + country="de", exclude_selectors=["string"], headers={"foo": "J!"}, include_frames=True, @@ -1118,6 +1133,7 @@ async def test_method_web_scrape_md(self, async_client: AsyncContextDev) -> None async def test_method_web_scrape_md_with_all_params(self, async_client: AsyncContextDev) -> None: web = await async_client.web.web_scrape_md( url="https://example.com", + country="de", exclude_selectors=["string"], headers={"foo": "J!"}, include_frames=True,