Skip to content

Commit 24905be

Browse files
feat: Add proxy hostname bypass hosts
1 parent fdaa3ac commit 24905be

File tree

8 files changed

+33
-6
lines changed

8 files changed

+33
-6
lines changed

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 101
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/kernel%2Fkernel-9462b3d8f055f8bda06da65583f5aa09a17d35254c5983796d8e84ebb3c62c47.yml
3-
openapi_spec_hash: 1914dd35b8e0e5a21ccec91eac2a616d
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/kernel%2Fkernel-d53de581fcac5c3b06940fc93667b9cd2a6a60dd3674da7c1f47484b0f442bf8.yml
3+
openapi_spec_hash: 177d0c537b7e5357c815bb64175e6484
44
config_hash: c6b88eea9a15840f26130eb8ed3b42a0

src/kernel/resources/proxies.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import httpx
88

99
from ..types import proxy_create_params
10-
from .._types import Body, Omit, Query, Headers, NoneType, NotGiven, omit, not_given
10+
from .._types import Body, Omit, Query, Headers, NoneType, NotGiven, SequenceNotStr, omit, not_given
1111
from .._utils import maybe_transform, async_maybe_transform
1212
from .._compat import cached_property
1313
from .._resource import SyncAPIResource, AsyncAPIResource
@@ -50,6 +50,7 @@ def create(
5050
self,
5151
*,
5252
type: Literal["datacenter", "isp", "residential", "mobile", "custom"],
53+
bypass_hosts: SequenceNotStr[str] | Omit = omit,
5354
config: proxy_create_params.Config | Omit = omit,
5455
name: str | Omit = omit,
5556
protocol: Literal["http", "https"] | Omit = omit,
@@ -67,6 +68,8 @@ def create(
6768
type: Proxy type to use. In terms of quality for avoiding bot-detection, from best to
6869
worst: `mobile` > `residential` > `isp` > `datacenter`.
6970
71+
bypass_hosts: Hostnames that should bypass the parent proxy and connect directly.
72+
7073
config: Configuration specific to the selected proxy `type`.
7174
7275
name: Readable name of the proxy.
@@ -86,6 +89,7 @@ def create(
8689
body=maybe_transform(
8790
{
8891
"type": type,
92+
"bypass_hosts": bypass_hosts,
8993
"config": config,
9094
"name": name,
9195
"protocol": protocol,
@@ -243,6 +247,7 @@ async def create(
243247
self,
244248
*,
245249
type: Literal["datacenter", "isp", "residential", "mobile", "custom"],
250+
bypass_hosts: SequenceNotStr[str] | Omit = omit,
246251
config: proxy_create_params.Config | Omit = omit,
247252
name: str | Omit = omit,
248253
protocol: Literal["http", "https"] | Omit = omit,
@@ -260,6 +265,8 @@ async def create(
260265
type: Proxy type to use. In terms of quality for avoiding bot-detection, from best to
261266
worst: `mobile` > `residential` > `isp` > `datacenter`.
262267
268+
bypass_hosts: Hostnames that should bypass the parent proxy and connect directly.
269+
263270
config: Configuration specific to the selected proxy `type`.
264271
265272
name: Readable name of the proxy.
@@ -279,6 +286,7 @@ async def create(
279286
body=await async_maybe_transform(
280287
{
281288
"type": type,
289+
"bypass_hosts": bypass_hosts,
282290
"config": config,
283291
"name": name,
284292
"protocol": protocol,

src/kernel/types/proxy_check_response.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
22

3-
from typing import Union, Optional
3+
from typing import List, Union, Optional
44
from datetime import datetime
55
from typing_extensions import Literal, TypeAlias
66

@@ -179,6 +179,9 @@ class ProxyCheckResponse(BaseModel):
179179

180180
id: Optional[str] = None
181181

182+
bypass_hosts: Optional[List[str]] = None
183+
"""Hostnames that should bypass the parent proxy and connect directly."""
184+
182185
config: Optional[Config] = None
183186
"""Configuration specific to the selected proxy `type`."""
184187

src/kernel/types/proxy_create_params.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
from typing import Union
66
from typing_extensions import Literal, Required, TypeAlias, TypedDict
77

8+
from .._types import SequenceNotStr
9+
810
__all__ = [
911
"ProxyCreateParams",
1012
"Config",
@@ -24,6 +26,9 @@ class ProxyCreateParams(TypedDict, total=False):
2426
`residential` > `isp` > `datacenter`.
2527
"""
2628

29+
bypass_hosts: SequenceNotStr[str]
30+
"""Hostnames that should bypass the parent proxy and connect directly."""
31+
2732
config: Config
2833
"""Configuration specific to the selected proxy `type`."""
2934

src/kernel/types/proxy_create_response.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
22

3-
from typing import Union, Optional
3+
from typing import List, Union, Optional
44
from datetime import datetime
55
from typing_extensions import Literal, TypeAlias
66

@@ -179,6 +179,9 @@ class ProxyCreateResponse(BaseModel):
179179

180180
id: Optional[str] = None
181181

182+
bypass_hosts: Optional[List[str]] = None
183+
"""Hostnames that should bypass the parent proxy and connect directly."""
184+
182185
config: Optional[Config] = None
183186
"""Configuration specific to the selected proxy `type`."""
184187

src/kernel/types/proxy_list_response.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,9 @@ class ProxyListResponseItem(BaseModel):
180180

181181
id: Optional[str] = None
182182

183+
bypass_hosts: Optional[List[str]] = None
184+
"""Hostnames that should bypass the parent proxy and connect directly."""
185+
183186
config: Optional[ProxyListResponseItemConfig] = None
184187
"""Configuration specific to the selected proxy `type`."""
185188

src/kernel/types/proxy_retrieve_response.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
22

3-
from typing import Union, Optional
3+
from typing import List, Union, Optional
44
from datetime import datetime
55
from typing_extensions import Literal, TypeAlias
66

@@ -179,6 +179,9 @@ class ProxyRetrieveResponse(BaseModel):
179179

180180
id: Optional[str] = None
181181

182+
bypass_hosts: Optional[List[str]] = None
183+
"""Hostnames that should bypass the parent proxy and connect directly."""
184+
182185
config: Optional[Config] = None
183186
"""Configuration specific to the selected proxy `type`."""
184187

tests/api_resources/test_proxies.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ def test_method_create(self, client: Kernel) -> None:
3535
def test_method_create_with_all_params(self, client: Kernel) -> None:
3636
proxy = client.proxies.create(
3737
type="datacenter",
38+
bypass_hosts=["string"],
3839
config={"country": "US"},
3940
name="name",
4041
protocol="http",
@@ -240,6 +241,7 @@ async def test_method_create(self, async_client: AsyncKernel) -> None:
240241
async def test_method_create_with_all_params(self, async_client: AsyncKernel) -> None:
241242
proxy = await async_client.proxies.create(
242243
type="datacenter",
244+
bypass_hosts=["string"],
243245
config={"country": "US"},
244246
name="name",
245247
protocol="http",

0 commit comments

Comments
 (0)