Skip to content

Commit 6296907

Browse files
chore(internal): remove unused http client options forwarding (#2158)
1 parent d137ed7 commit 6296907

File tree

1 file changed

+1
-96
lines changed

1 file changed

+1
-96
lines changed

src/openai/_base_client.py

Lines changed: 1 addition & 96 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
import inspect
1010
import logging
1111
import platform
12-
import warnings
1312
import email.utils
1413
from types import TracebackType
1514
from random import random
@@ -36,7 +35,7 @@
3635
import httpx
3736
import distro
3837
import pydantic
39-
from httpx import URL, Limits
38+
from httpx import URL
4039
from pydantic import PrivateAttr
4140

4241
from . import _exceptions
@@ -51,13 +50,10 @@
5150
Timeout,
5251
NotGiven,
5352
ResponseT,
54-
Transport,
5553
AnyMapping,
5654
PostParser,
57-
ProxiesTypes,
5855
RequestFiles,
5956
HttpxSendArgs,
60-
AsyncTransport,
6157
RequestOptions,
6258
HttpxRequestFiles,
6359
ModelBuilderProtocol,
@@ -338,9 +334,6 @@ class BaseClient(Generic[_HttpxClientT, _DefaultStreamT]):
338334
_base_url: URL
339335
max_retries: int
340336
timeout: Union[float, Timeout, None]
341-
_limits: httpx.Limits
342-
_proxies: ProxiesTypes | None
343-
_transport: Transport | AsyncTransport | None
344337
_strict_response_validation: bool
345338
_idempotency_header: str | None
346339
_default_stream_cls: type[_DefaultStreamT] | None = None
@@ -353,19 +346,13 @@ def __init__(
353346
_strict_response_validation: bool,
354347
max_retries: int = DEFAULT_MAX_RETRIES,
355348
timeout: float | Timeout | None = DEFAULT_TIMEOUT,
356-
limits: httpx.Limits,
357-
transport: Transport | AsyncTransport | None,
358-
proxies: ProxiesTypes | None,
359349
custom_headers: Mapping[str, str] | None = None,
360350
custom_query: Mapping[str, object] | None = None,
361351
) -> None:
362352
self._version = version
363353
self._base_url = self._enforce_trailing_slash(URL(base_url))
364354
self.max_retries = max_retries
365355
self.timeout = timeout
366-
self._limits = limits
367-
self._proxies = proxies
368-
self._transport = transport
369356
self._custom_headers = custom_headers or {}
370357
self._custom_query = custom_query or {}
371358
self._strict_response_validation = _strict_response_validation
@@ -801,46 +788,11 @@ def __init__(
801788
base_url: str | URL,
802789
max_retries: int = DEFAULT_MAX_RETRIES,
803790
timeout: float | Timeout | None | NotGiven = NOT_GIVEN,
804-
transport: Transport | None = None,
805-
proxies: ProxiesTypes | None = None,
806-
limits: Limits | None = None,
807791
http_client: httpx.Client | None = None,
808792
custom_headers: Mapping[str, str] | None = None,
809793
custom_query: Mapping[str, object] | None = None,
810794
_strict_response_validation: bool,
811795
) -> None:
812-
kwargs: dict[str, Any] = {}
813-
if limits is not None:
814-
warnings.warn(
815-
"The `connection_pool_limits` argument is deprecated. The `http_client` argument should be passed instead",
816-
category=DeprecationWarning,
817-
stacklevel=3,
818-
)
819-
if http_client is not None:
820-
raise ValueError("The `http_client` argument is mutually exclusive with `connection_pool_limits`")
821-
else:
822-
limits = DEFAULT_CONNECTION_LIMITS
823-
824-
if transport is not None:
825-
kwargs["transport"] = transport
826-
warnings.warn(
827-
"The `transport` argument is deprecated. The `http_client` argument should be passed instead",
828-
category=DeprecationWarning,
829-
stacklevel=3,
830-
)
831-
if http_client is not None:
832-
raise ValueError("The `http_client` argument is mutually exclusive with `transport`")
833-
834-
if proxies is not None:
835-
kwargs["proxies"] = proxies
836-
warnings.warn(
837-
"The `proxies` argument is deprecated. The `http_client` argument should be passed instead",
838-
category=DeprecationWarning,
839-
stacklevel=3,
840-
)
841-
if http_client is not None:
842-
raise ValueError("The `http_client` argument is mutually exclusive with `proxies`")
843-
844796
if not is_given(timeout):
845797
# if the user passed in a custom http client with a non-default
846798
# timeout set then we use that timeout.
@@ -861,12 +813,9 @@ def __init__(
861813

862814
super().__init__(
863815
version=version,
864-
limits=limits,
865816
# cast to a valid type because mypy doesn't understand our type narrowing
866817
timeout=cast(Timeout, timeout),
867-
proxies=proxies,
868818
base_url=base_url,
869-
transport=transport,
870819
max_retries=max_retries,
871820
custom_query=custom_query,
872821
custom_headers=custom_headers,
@@ -876,9 +825,6 @@ def __init__(
876825
base_url=base_url,
877826
# cast to a valid type because mypy doesn't understand our type narrowing
878827
timeout=cast(Timeout, timeout),
879-
limits=limits,
880-
follow_redirects=True,
881-
**kwargs, # type: ignore
882828
)
883829

884830
def is_closed(self) -> bool:
@@ -1388,45 +1334,10 @@ def __init__(
13881334
_strict_response_validation: bool,
13891335
max_retries: int = DEFAULT_MAX_RETRIES,
13901336
timeout: float | Timeout | None | NotGiven = NOT_GIVEN,
1391-
transport: AsyncTransport | None = None,
1392-
proxies: ProxiesTypes | None = None,
1393-
limits: Limits | None = None,
13941337
http_client: httpx.AsyncClient | None = None,
13951338
custom_headers: Mapping[str, str] | None = None,
13961339
custom_query: Mapping[str, object] | None = None,
13971340
) -> None:
1398-
kwargs: dict[str, Any] = {}
1399-
if limits is not None:
1400-
warnings.warn(
1401-
"The `connection_pool_limits` argument is deprecated. The `http_client` argument should be passed instead",
1402-
category=DeprecationWarning,
1403-
stacklevel=3,
1404-
)
1405-
if http_client is not None:
1406-
raise ValueError("The `http_client` argument is mutually exclusive with `connection_pool_limits`")
1407-
else:
1408-
limits = DEFAULT_CONNECTION_LIMITS
1409-
1410-
if transport is not None:
1411-
kwargs["transport"] = transport
1412-
warnings.warn(
1413-
"The `transport` argument is deprecated. The `http_client` argument should be passed instead",
1414-
category=DeprecationWarning,
1415-
stacklevel=3,
1416-
)
1417-
if http_client is not None:
1418-
raise ValueError("The `http_client` argument is mutually exclusive with `transport`")
1419-
1420-
if proxies is not None:
1421-
kwargs["proxies"] = proxies
1422-
warnings.warn(
1423-
"The `proxies` argument is deprecated. The `http_client` argument should be passed instead",
1424-
category=DeprecationWarning,
1425-
stacklevel=3,
1426-
)
1427-
if http_client is not None:
1428-
raise ValueError("The `http_client` argument is mutually exclusive with `proxies`")
1429-
14301341
if not is_given(timeout):
14311342
# if the user passed in a custom http client with a non-default
14321343
# timeout set then we use that timeout.
@@ -1448,11 +1359,8 @@ def __init__(
14481359
super().__init__(
14491360
version=version,
14501361
base_url=base_url,
1451-
limits=limits,
14521362
# cast to a valid type because mypy doesn't understand our type narrowing
14531363
timeout=cast(Timeout, timeout),
1454-
proxies=proxies,
1455-
transport=transport,
14561364
max_retries=max_retries,
14571365
custom_query=custom_query,
14581366
custom_headers=custom_headers,
@@ -1462,9 +1370,6 @@ def __init__(
14621370
base_url=base_url,
14631371
# cast to a valid type because mypy doesn't understand our type narrowing
14641372
timeout=cast(Timeout, timeout),
1465-
limits=limits,
1466-
follow_redirects=True,
1467-
**kwargs, # type: ignore
14681373
)
14691374

14701375
def is_closed(self) -> bool:

0 commit comments

Comments
 (0)