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 ,
@@ -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 :
@@ -1387,45 +1333,10 @@ def __init__(
13871333 _strict_response_validation : bool ,
13881334 max_retries : int = DEFAULT_MAX_RETRIES ,
13891335 timeout : float | Timeout | None | NotGiven = NOT_GIVEN ,
1390- transport : AsyncTransport | None = None ,
1391- proxies : ProxiesTypes | None = None ,
1392- limits : Limits | None = None ,
13931336 http_client : httpx .AsyncClient | None = None ,
13941337 custom_headers : Mapping [str , str ] | None = None ,
13951338 custom_query : Mapping [str , object ] | None = None ,
13961339 ) -> None :
1397- kwargs : dict [str , Any ] = {}
1398- if limits is not None :
1399- warnings .warn (
1400- "The `connection_pool_limits` argument is deprecated. The `http_client` argument should be passed instead" ,
1401- category = DeprecationWarning ,
1402- stacklevel = 3 ,
1403- )
1404- if http_client is not None :
1405- raise ValueError ("The `http_client` argument is mutually exclusive with `connection_pool_limits`" )
1406- else :
1407- limits = DEFAULT_CONNECTION_LIMITS
1408-
1409- if transport is not None :
1410- kwargs ["transport" ] = transport
1411- warnings .warn (
1412- "The `transport` argument is deprecated. The `http_client` argument should be passed instead" ,
1413- category = DeprecationWarning ,
1414- stacklevel = 3 ,
1415- )
1416- if http_client is not None :
1417- raise ValueError ("The `http_client` argument is mutually exclusive with `transport`" )
1418-
1419- if proxies is not None :
1420- kwargs ["proxies" ] = proxies
1421- warnings .warn (
1422- "The `proxies` argument is deprecated. The `http_client` argument should be passed instead" ,
1423- category = DeprecationWarning ,
1424- stacklevel = 3 ,
1425- )
1426- if http_client is not None :
1427- raise ValueError ("The `http_client` argument is mutually exclusive with `proxies`" )
1428-
14291340 if not is_given (timeout ):
14301341 # if the user passed in a custom http client with a non-default
14311342 # timeout set then we use that timeout.
@@ -1447,11 +1358,8 @@ def __init__(
14471358 super ().__init__ (
14481359 version = version ,
14491360 base_url = base_url ,
1450- limits = limits ,
14511361 # cast to a valid type because mypy doesn't understand our type narrowing
14521362 timeout = cast (Timeout , timeout ),
1453- proxies = proxies ,
1454- transport = transport ,
14551363 max_retries = max_retries ,
14561364 custom_query = custom_query ,
14571365 custom_headers = custom_headers ,
@@ -1461,9 +1369,6 @@ def __init__(
14611369 base_url = base_url ,
14621370 # cast to a valid type because mypy doesn't understand our type narrowing
14631371 timeout = cast (Timeout , timeout ),
1464- limits = limits ,
1465- follow_redirects = True ,
1466- ** kwargs , # type: ignore
14671372 )
14681373
14691374 def is_closed (self ) -> bool :
0 commit comments