Skip to content

Commit bb7838a

Browse files
committed
Don't overwrite transport by default so users can use proxies via environment variables.
1 parent ed488a9 commit bb7838a

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

workos/utils/http_client.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def __init__(
3838
client_id: str,
3939
version: str,
4040
timeout: Optional[int] = None,
41-
transport: Optional[httpx.BaseTransport] = httpx.HTTPTransport(),
41+
transport: Optional[httpx.BaseTransport] = None,
4242
) -> None:
4343
super().__init__(
4444
api_key=api_key,
@@ -51,7 +51,9 @@ def __init__(
5151
base_url=base_url,
5252
timeout=timeout,
5353
follow_redirects=True,
54-
transport=transport,
54+
# Only pass the transport if a custom one is provided, otherwise let httpx use
55+
# the default so we don't overwrite environment configurations like proxies
56+
transport=transport if transport else None,
5557
)
5658

5759
def is_closed(self) -> bool:
@@ -136,7 +138,7 @@ def __init__(
136138
client_id: str,
137139
version: str,
138140
timeout: Optional[int] = None,
139-
transport: Optional[httpx.AsyncBaseTransport] = httpx.AsyncHTTPTransport(),
141+
transport: Optional[httpx.AsyncBaseTransport] = None,
140142
) -> None:
141143
super().__init__(
142144
base_url=base_url,
@@ -149,7 +151,9 @@ def __init__(
149151
base_url=base_url,
150152
timeout=timeout,
151153
follow_redirects=True,
152-
transport=transport,
154+
# Only pass the transport if a custom one is provided, otherwise let httpx use
155+
# the default so we don't overwrite environment configurations like proxies
156+
transport=transport if transport else None,
153157
)
154158

155159
def is_closed(self) -> bool:

0 commit comments

Comments
 (0)