99import inspect
1010import logging
1111import platform
12- import warnings
1312import email .utils
1413from types import TracebackType
1514from random import random
3635import httpx
3736import distro
3837import pydantic
39- from httpx import URL , Limits
38+ from httpx import URL
4039from pydantic import PrivateAttr
4140
4241from . import _exceptions
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 ,
@@ -339,9 +335,6 @@ class BaseClient(Generic[_HttpxClientT, _DefaultStreamT]):
339335 _base_url : URL
340336 max_retries : int
341337 timeout : Union [float , Timeout , None ]
342- _limits : httpx .Limits
343- _proxies : ProxiesTypes | None
344- _transport : Transport | AsyncTransport | None
345338 _strict_response_validation : bool
346339 _idempotency_header : str | None
347340 _default_stream_cls : type [_DefaultStreamT ] | None = None
@@ -354,19 +347,13 @@ def __init__(
354347 _strict_response_validation : bool ,
355348 max_retries : int = DEFAULT_MAX_RETRIES ,
356349 timeout : float | Timeout | None = DEFAULT_TIMEOUT ,
357- limits : httpx .Limits ,
358- transport : Transport | AsyncTransport | None ,
359- proxies : ProxiesTypes | None ,
360350 custom_headers : Mapping [str , str ] | None = None ,
361351 custom_query : Mapping [str , object ] | None = None ,
362352 ) -> None :
363353 self ._version = version
364354 self ._base_url = self ._enforce_trailing_slash (URL (base_url ))
365355 self .max_retries = max_retries
366356 self .timeout = timeout
367- self ._limits = limits
368- self ._proxies = proxies
369- self ._transport = transport
370357 self ._custom_headers = custom_headers or {}
371358 self ._custom_query = custom_query or {}
372359 self ._strict_response_validation = _strict_response_validation
@@ -802,46 +789,11 @@ def __init__(
802789 base_url : str | URL ,
803790 max_retries : int = DEFAULT_MAX_RETRIES ,
804791 timeout : float | Timeout | None | NotGiven = NOT_GIVEN ,
805- transport : Transport | None = None ,
806- proxies : ProxiesTypes | None = None ,
807- limits : Limits | None = None ,
808792 http_client : httpx .Client | None = None ,
809793 custom_headers : Mapping [str , str ] | None = None ,
810794 custom_query : Mapping [str , object ] | None = None ,
811795 _strict_response_validation : bool ,
812796 ) -> None :
813- kwargs : dict [str , Any ] = {}
814- if limits is not None :
815- warnings .warn (
816- "The `connection_pool_limits` argument is deprecated. The `http_client` argument should be passed instead" ,
817- category = DeprecationWarning ,
818- stacklevel = 3 ,
819- )
820- if http_client is not None :
821- raise ValueError ("The `http_client` argument is mutually exclusive with `connection_pool_limits`" )
822- else :
823- limits = DEFAULT_CONNECTION_LIMITS
824-
825- if transport is not None :
826- kwargs ["transport" ] = transport
827- warnings .warn (
828- "The `transport` argument is deprecated. The `http_client` argument should be passed instead" ,
829- category = DeprecationWarning ,
830- stacklevel = 3 ,
831- )
832- if http_client is not None :
833- raise ValueError ("The `http_client` argument is mutually exclusive with `transport`" )
834-
835- if proxies is not None :
836- kwargs ["proxies" ] = proxies
837- warnings .warn (
838- "The `proxies` argument is deprecated. The `http_client` argument should be passed instead" ,
839- category = DeprecationWarning ,
840- stacklevel = 3 ,
841- )
842- if http_client is not None :
843- raise ValueError ("The `http_client` argument is mutually exclusive with `proxies`" )
844-
845797 if not is_given (timeout ):
846798 # if the user passed in a custom http client with a non-default
847799 # timeout set then we use that timeout.
@@ -862,12 +814,9 @@ def __init__(
862814
863815 super ().__init__ (
864816 version = version ,
865- limits = limits ,
866817 # cast to a valid type because mypy doesn't understand our type narrowing
867818 timeout = cast (Timeout , timeout ),
868- proxies = proxies ,
869819 base_url = base_url ,
870- transport = transport ,
871820 max_retries = max_retries ,
872821 custom_query = custom_query ,
873822 custom_headers = custom_headers ,
@@ -877,9 +826,6 @@ def __init__(
877826 base_url = base_url ,
878827 # cast to a valid type because mypy doesn't understand our type narrowing
879828 timeout = cast (Timeout , timeout ),
880- limits = limits ,
881- follow_redirects = True ,
882- ** kwargs , # type: ignore
883829 )
884830
885831 def is_closed (self ) -> bool :
@@ -1389,45 +1335,10 @@ def __init__(
13891335 _strict_response_validation : bool ,
13901336 max_retries : int = DEFAULT_MAX_RETRIES ,
13911337 timeout : float | Timeout | None | NotGiven = NOT_GIVEN ,
1392- transport : AsyncTransport | None = None ,
1393- proxies : ProxiesTypes | None = None ,
1394- limits : Limits | None = None ,
13951338 http_client : httpx .AsyncClient | None = None ,
13961339 custom_headers : Mapping [str , str ] | None = None ,
13971340 custom_query : Mapping [str , object ] | None = None ,
13981341 ) -> None :
1399- kwargs : dict [str , Any ] = {}
1400- if limits is not None :
1401- warnings .warn (
1402- "The `connection_pool_limits` argument is deprecated. The `http_client` argument should be passed instead" ,
1403- category = DeprecationWarning ,
1404- stacklevel = 3 ,
1405- )
1406- if http_client is not None :
1407- raise ValueError ("The `http_client` argument is mutually exclusive with `connection_pool_limits`" )
1408- else :
1409- limits = DEFAULT_CONNECTION_LIMITS
1410-
1411- if transport is not None :
1412- kwargs ["transport" ] = transport
1413- warnings .warn (
1414- "The `transport` argument is deprecated. The `http_client` argument should be passed instead" ,
1415- category = DeprecationWarning ,
1416- stacklevel = 3 ,
1417- )
1418- if http_client is not None :
1419- raise ValueError ("The `http_client` argument is mutually exclusive with `transport`" )
1420-
1421- if proxies is not None :
1422- kwargs ["proxies" ] = proxies
1423- warnings .warn (
1424- "The `proxies` argument is deprecated. The `http_client` argument should be passed instead" ,
1425- category = DeprecationWarning ,
1426- stacklevel = 3 ,
1427- )
1428- if http_client is not None :
1429- raise ValueError ("The `http_client` argument is mutually exclusive with `proxies`" )
1430-
14311342 if not is_given (timeout ):
14321343 # if the user passed in a custom http client with a non-default
14331344 # timeout set then we use that timeout.
@@ -1449,11 +1360,8 @@ def __init__(
14491360 super ().__init__ (
14501361 version = version ,
14511362 base_url = base_url ,
1452- limits = limits ,
14531363 # cast to a valid type because mypy doesn't understand our type narrowing
14541364 timeout = cast (Timeout , timeout ),
1455- proxies = proxies ,
1456- transport = transport ,
14571365 max_retries = max_retries ,
14581366 custom_query = custom_query ,
14591367 custom_headers = custom_headers ,
@@ -1463,9 +1371,6 @@ def __init__(
14631371 base_url = base_url ,
14641372 # cast to a valid type because mypy doesn't understand our type narrowing
14651373 timeout = cast (Timeout , timeout ),
1466- limits = limits ,
1467- follow_redirects = True ,
1468- ** kwargs , # type: ignore
14691374 )
14701375
14711376 def is_closed (self ) -> bool :
0 commit comments