Skip to content

Commit

Permalink
fix(client): compat with new httpx 0.28.0 release (openai#1904)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-app[bot] committed Nov 28, 2024
1 parent 988ae7d commit 3cfd36e
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/openai/_base_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -794,6 +794,7 @@ def __init__(
custom_query: Mapping[str, object] | None = None,
_strict_response_validation: bool,
) -> None:
kwargs: dict[str, Any] = {}
if limits is not None:
warnings.warn(
"The `connection_pool_limits` argument is deprecated. The `http_client` argument should be passed instead",
Expand All @@ -806,6 +807,7 @@ def __init__(
limits = DEFAULT_CONNECTION_LIMITS

if transport is not None:
kwargs["transport"] = transport
warnings.warn(
"The `transport` argument is deprecated. The `http_client` argument should be passed instead",
category=DeprecationWarning,
Expand All @@ -815,6 +817,7 @@ def __init__(
raise ValueError("The `http_client` argument is mutually exclusive with `transport`")

if proxies is not None:
kwargs["proxies"] = proxies
warnings.warn(
"The `proxies` argument is deprecated. The `http_client` argument should be passed instead",
category=DeprecationWarning,
Expand Down Expand Up @@ -858,10 +861,9 @@ def __init__(
base_url=base_url,
# cast to a valid type because mypy doesn't understand our type narrowing
timeout=cast(Timeout, timeout),
proxies=proxies,
transport=transport,
limits=limits,
follow_redirects=True,
**kwargs, # type: ignore
)

def is_closed(self) -> bool:
Expand Down Expand Up @@ -1375,6 +1377,7 @@ def __init__(
custom_headers: Mapping[str, str] | None = None,
custom_query: Mapping[str, object] | None = None,
) -> None:
kwargs: dict[str, Any] = {}
if limits is not None:
warnings.warn(
"The `connection_pool_limits` argument is deprecated. The `http_client` argument should be passed instead",
Expand All @@ -1387,6 +1390,7 @@ def __init__(
limits = DEFAULT_CONNECTION_LIMITS

if transport is not None:
kwargs["transport"] = transport
warnings.warn(
"The `transport` argument is deprecated. The `http_client` argument should be passed instead",
category=DeprecationWarning,
Expand All @@ -1396,6 +1400,7 @@ def __init__(
raise ValueError("The `http_client` argument is mutually exclusive with `transport`")

if proxies is not None:
kwargs["proxies"] = proxies
warnings.warn(
"The `proxies` argument is deprecated. The `http_client` argument should be passed instead",
category=DeprecationWarning,
Expand Down Expand Up @@ -1439,10 +1444,9 @@ def __init__(
base_url=base_url,
# cast to a valid type because mypy doesn't understand our type narrowing
timeout=cast(Timeout, timeout),
proxies=proxies,
transport=transport,
limits=limits,
follow_redirects=True,
**kwargs, # type: ignore
)

def is_closed(self) -> bool:
Expand Down

0 comments on commit 3cfd36e

Please sign in to comment.