From 5e04d2ae7fdc512f33b30a572cdf6ff9e559b17e Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 26 Jun 2026 16:46:59 +0000 Subject: [PATCH 1/5] feat(api): api update --- .stats.yml | 4 +- src/context/dev/resources/web.py | 1690 +++++++++++++++++ .../dev/types/web_screenshot_params.py | 211 ++ .../dev/types/web_web_crawl_md_params.py | 214 ++- .../dev/types/web_web_scrape_html_params.py | 213 ++- .../dev/types/web_web_scrape_md_params.py | 213 ++- tests/api_resources/test_web.py | 8 + 7 files changed, 2548 insertions(+), 5 deletions(-) diff --git a/.stats.yml b/.stats.yml index e34b116..24c57ba 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-00c5b8f1ebfe212bc8fb46204f5c05507630afa55b10f77e3a43c66d21edbb77.yml +openapi_spec_hash: 8bf4489b9bce0e52a89480109ffc5257 config_hash: c7b0cdaba3b9797b77efd89e1754d803 diff --git a/src/context/dev/resources/web.py b/src/context/dev/resources/web.py index b320e57..a1eb977 100644 --- a/src/context/dev/resources/web.py +++ b/src/context/dev/resources/web.py @@ -353,6 +353,213 @@ def extract_styleguide( def screenshot( self, *, + 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 +581,9 @@ def screenshot( Capture a screenshot of a website. Args: + 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 +644,7 @@ def screenshot( timeout=timeout, query=maybe_transform( { + "country": country, "direct_url": direct_url, "domain": domain, "full_screenshot": full_screenshot, @@ -522,6 +733,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 +970,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 +1037,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 +1067,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 +1296,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 +1349,7 @@ def web_scrape_html( query=maybe_transform( { "url": url, + "country": country, "exclude_selectors": exclude_selectors, "headers": headers, "include_frames": include_frames, @@ -808,6 +1442,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 +1675,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 +1733,7 @@ def web_scrape_md( query=maybe_transform( { "url": url, + "country": country, "exclude_selectors": exclude_selectors, "headers": headers, "include_frames": include_frames, @@ -1280,6 +2125,213 @@ async def extract_styleguide( async def screenshot( self, *, + 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 +2353,9 @@ async def screenshot( Capture a screenshot of a website. Args: + 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 +2416,7 @@ async def screenshot( timeout=timeout, query=await async_maybe_transform( { + "country": country, "direct_url": direct_url, "domain": domain, "full_screenshot": full_screenshot, @@ -1449,6 +2505,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 +2742,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 +2809,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 +2839,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 +3068,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 +3121,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 +3214,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 +3447,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 +3505,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_screenshot_params.py b/src/context/dev/types/web_screenshot_params.py index fc01822..b9f0019 100644 --- a/src/context/dev/types/web_screenshot_params.py +++ b/src/context/dev/types/web_screenshot_params.py @@ -10,6 +10,217 @@ class WebScreenshotParams(TypedDict, total=False): + 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_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..dd97cbd 100644 --- a/tests/api_resources/test_web.py +++ b/tests/api_resources/test_web.py @@ -242,6 +242,7 @@ def test_method_screenshot(self, client: ContextDev) -> None: @parametrize def test_method_screenshot_with_all_params(self, client: ContextDev) -> None: web = client.web.screenshot( + country="de", direct_url="https://example.com", domain="domain", full_screenshot="true", @@ -356,6 +357,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 +420,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 +528,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, @@ -835,6 +839,7 @@ 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( + country="de", direct_url="https://example.com", domain="domain", full_screenshot="true", @@ -949,6 +954,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 +1017,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 +1125,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, From e9fb3b8875c03ee4d0e259a7a26bde6592693f55 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 26 Jun 2026 21:26:44 +0000 Subject: [PATCH 2/5] feat(api): api update --- .stats.yml | 4 +- src/context/dev/resources/web.py | 506 ++++++++++++++++++++- src/context/dev/types/web_search_params.py | 255 ++++++++++- tests/api_resources/test_web.py | 4 + 4 files changed, 764 insertions(+), 5 deletions(-) diff --git a/.stats.yml b/.stats.yml index 24c57ba..9dc6067 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-00c5b8f1ebfe212bc8fb46204f5c05507630afa55b10f77e3a43c66d21edbb77.yml -openapi_spec_hash: 8bf4489b9bce0e52a89480109ffc5257 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-d3da262409c68576e457536f6c0e7ecc538219e0af19df415111c18f8fe92cfd.yml +openapi_spec_hash: 25009575202702d24bc6672472eb8506 config_hash: c7b0cdaba3b9797b77efd89e1754d803 diff --git a/src/context/dev/resources/web.py b/src/context/dev/resources/web.py index a1eb977..54cd471 100644 --- a/src/context/dev/resources/web.py +++ b/src/context/dev/resources/web.py @@ -666,10 +666,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. @@ -683,7 +926,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"]. @@ -695,6 +942,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 @@ -714,10 +963,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, }, @@ -2438,10 +2689,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. @@ -2455,7 +2949,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"]. @@ -2467,6 +2965,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 @@ -2486,10 +2986,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, }, 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/tests/api_resources/test_web.py b/tests/api_resources/test_web.py index dd97cbd..7caa1b4 100644 --- a/tests/api_resources/test_web.py +++ b/tests/api_resources/test_web.py @@ -294,6 +294,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"], @@ -313,6 +314,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, ) @@ -891,6 +893,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"], @@ -910,6 +913,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, ) From de020ba84656fed630deec2bf184ce4ca532f7b0 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 27 Jun 2026 20:25:14 +0000 Subject: [PATCH 3/5] feat(api): api update --- .stats.yml | 4 ++-- src/context/dev/resources/web.py | 10 ++++++++++ src/context/dev/types/web_screenshot_params.py | 6 ++++++ tests/api_resources/test_web.py | 2 ++ 4 files changed, 20 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 9dc6067..0e801d6 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-d3da262409c68576e457536f6c0e7ecc538219e0af19df415111c18f8fe92cfd.yml -openapi_spec_hash: 25009575202702d24bc6672472eb8506 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-a4f78808dc23a76896b451576b3b44b0d663977f2032eaed0271dd386b20c43c.yml +openapi_spec_hash: 01f9e1ae0d635f8b874f48e3ba461476 config_hash: c7b0cdaba3b9797b77efd89e1754d803 diff --git a/src/context/dev/resources/web.py b/src/context/dev/resources/web.py index 54cd471..4658339 100644 --- a/src/context/dev/resources/web.py +++ b/src/context/dev/resources/web.py @@ -353,6 +353,7 @@ def extract_styleguide( def screenshot( self, *, + color_scheme: Literal["light", "dark"] | Omit = omit, country: Literal[ "ad", "ae", @@ -581,6 +582,9 @@ 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. @@ -644,6 +648,7 @@ def screenshot( timeout=timeout, query=maybe_transform( { + "color_scheme": color_scheme, "country": country, "direct_url": direct_url, "domain": domain, @@ -2376,6 +2381,7 @@ async def extract_styleguide( async def screenshot( self, *, + color_scheme: Literal["light", "dark"] | Omit = omit, country: Literal[ "ad", "ae", @@ -2604,6 +2610,9 @@ 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. @@ -2667,6 +2676,7 @@ async def screenshot( timeout=timeout, query=await async_maybe_transform( { + "color_scheme": color_scheme, "country": country, "direct_url": direct_url, "domain": domain, diff --git a/src/context/dev/types/web_screenshot_params.py b/src/context/dev/types/web_screenshot_params.py index b9f0019..122c095 100644 --- a/src/context/dev/types/web_screenshot_params.py +++ b/src/context/dev/types/web_screenshot_params.py @@ -10,6 +10,12 @@ 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", diff --git a/tests/api_resources/test_web.py b/tests/api_resources/test_web.py index 7caa1b4..a700cbf 100644 --- a/tests/api_resources/test_web.py +++ b/tests/api_resources/test_web.py @@ -242,6 +242,7 @@ 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", @@ -841,6 +842,7 @@ 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", From 33f8f8a08a90748790a99c3cc7ce7a573af9575f Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 27 Jun 2026 21:20:18 +0000 Subject: [PATCH 4/5] feat(api): api update --- .stats.yml | 4 ++-- src/context/dev/resources/web.py | 10 ++++++++++ src/context/dev/types/web_extract_styleguide_params.py | 8 +++++++- tests/api_resources/test_web.py | 2 ++ 4 files changed, 21 insertions(+), 3 deletions(-) diff --git a/.stats.yml b/.stats.yml index 0e801d6..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-a4f78808dc23a76896b451576b3b44b0d663977f2032eaed0271dd386b20c43c.yml -openapi_spec_hash: 01f9e1ae0d635f8b874f48e3ba461476 +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/src/context/dev/resources/web.py b/src/context/dev/resources/web.py index 4658339..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, @@ -2316,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, @@ -2332,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 @@ -2367,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, 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/tests/api_resources/test_web.py b/tests/api_resources/test_web.py index a700cbf..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, @@ -803,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, From c1745948b0c0f69b27ca504e3dff2c913a12e3aa Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 27 Jun 2026 21:20:39 +0000 Subject: [PATCH 5/5] release: 1.3.0 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 11 +++++++++++ pyproject.toml | 2 +- src/context/dev/_version.py | 2 +- 4 files changed, 14 insertions(+), 3 deletions(-) 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/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