|
2 | 2 |
|
3 | 3 | from __future__ import annotations |
4 | 4 |
|
5 | | -from typing import Dict, Union |
6 | | -from typing_extensions import Literal, Required, Annotated, TypedDict |
| 5 | +from typing import Dict, Union, Iterable |
| 6 | +from typing_extensions import Literal, Required, Annotated, TypeAlias, TypedDict |
7 | 7 |
|
8 | 8 | from .._utils import PropertyInfo |
9 | 9 |
|
10 | | -__all__ = ["SessionCreateParams", "BrowserSettings", "BrowserSettingsContext", "BrowserSettingsViewport"] |
| 10 | +__all__ = [ |
| 11 | + "SessionCreateParams", |
| 12 | + "BrowserSettings", |
| 13 | + "BrowserSettingsContext", |
| 14 | + "BrowserSettingsViewport", |
| 15 | + "ProxiesUnionMember1", |
| 16 | + "ProxiesUnionMember1BrowserbaseProxyConfig", |
| 17 | + "ProxiesUnionMember1BrowserbaseProxyConfigGeolocation", |
| 18 | + "ProxiesUnionMember1ExternalProxyConfig", |
| 19 | + "ProxiesUnionMember1NoneProxyConfig", |
| 20 | +] |
11 | 21 |
|
12 | 22 |
|
13 | 23 | class SessionCreateParams(TypedDict, total=False): |
@@ -37,7 +47,7 @@ class SessionCreateParams(TypedDict, total=False): |
37 | 47 | Can be found in [Settings](https://www.browserbase.com/settings). |
38 | 48 | """ |
39 | 49 |
|
40 | | - proxies: Union[bool, object] |
| 50 | + proxies: Union[bool, Iterable[ProxiesUnionMember1]] |
41 | 51 | """Proxy configuration. |
42 | 52 |
|
43 | 53 | Can be true for default proxy, or an array of proxy configurations. |
@@ -111,3 +121,68 @@ class BrowserSettings(TypedDict, total=False): |
111 | 121 | """Enable or disable captcha solving in the browser. Defaults to `true`.""" |
112 | 122 |
|
113 | 123 | viewport: BrowserSettingsViewport |
| 124 | + |
| 125 | + |
| 126 | +class ProxiesUnionMember1BrowserbaseProxyConfigGeolocation(TypedDict, total=False): |
| 127 | + """Configuration for geolocation""" |
| 128 | + |
| 129 | + country: Required[str] |
| 130 | + """Country code in ISO 3166-1 alpha-2 format""" |
| 131 | + |
| 132 | + city: str |
| 133 | + """Name of the city. Use spaces for multi-word city names. Optional.""" |
| 134 | + |
| 135 | + state: str |
| 136 | + """US state code (2 characters). Must also specify US as the country. Optional.""" |
| 137 | + |
| 138 | + |
| 139 | +class ProxiesUnionMember1BrowserbaseProxyConfig(TypedDict, total=False): |
| 140 | + type: Required[Literal["browserbase"]] |
| 141 | + """Type of proxy. |
| 142 | +
|
| 143 | + Always use 'browserbase' for the Browserbase managed proxy network. |
| 144 | + """ |
| 145 | + |
| 146 | + domain_pattern: Annotated[str, PropertyInfo(alias="domainPattern")] |
| 147 | + """Domain pattern for which this proxy should be used. |
| 148 | +
|
| 149 | + If omitted, defaults to all domains. Optional. |
| 150 | + """ |
| 151 | + |
| 152 | + geolocation: ProxiesUnionMember1BrowserbaseProxyConfigGeolocation |
| 153 | + """Configuration for geolocation""" |
| 154 | + |
| 155 | + |
| 156 | +class ProxiesUnionMember1ExternalProxyConfig(TypedDict, total=False): |
| 157 | + server: Required[str] |
| 158 | + """Server URL for external proxy. Required.""" |
| 159 | + |
| 160 | + type: Required[Literal["external"]] |
| 161 | + """Type of proxy. Always 'external' for this config.""" |
| 162 | + |
| 163 | + domain_pattern: Annotated[str, PropertyInfo(alias="domainPattern")] |
| 164 | + """Domain pattern for which this proxy should be used. |
| 165 | +
|
| 166 | + If omitted, defaults to all domains. Optional. |
| 167 | + """ |
| 168 | + |
| 169 | + password: str |
| 170 | + """Password for external proxy authentication. Optional.""" |
| 171 | + |
| 172 | + username: str |
| 173 | + """Username for external proxy authentication. Optional.""" |
| 174 | + |
| 175 | + |
| 176 | +class ProxiesUnionMember1NoneProxyConfig(TypedDict, total=False): |
| 177 | + domain_pattern: Required[Annotated[str, PropertyInfo(alias="domainPattern")]] |
| 178 | + """Domain pattern for which site should have proxies disabled.""" |
| 179 | + |
| 180 | + type: Required[Literal["none"]] |
| 181 | + """Type of proxy. Use 'none' to disable proxy for matching domains.""" |
| 182 | + |
| 183 | + |
| 184 | +ProxiesUnionMember1: TypeAlias = Union[ |
| 185 | + ProxiesUnionMember1BrowserbaseProxyConfig, |
| 186 | + ProxiesUnionMember1ExternalProxyConfig, |
| 187 | + ProxiesUnionMember1NoneProxyConfig, |
| 188 | +] |
0 commit comments