9
9
import inspect
10
10
import logging
11
11
import platform
12
- import warnings
13
12
import email .utils
14
13
from types import TracebackType
15
14
from random import random
36
35
import httpx
37
36
import distro
38
37
import pydantic
39
- from httpx import URL , Limits
38
+ from httpx import URL
40
39
from pydantic import PrivateAttr
41
40
42
41
from . import _exceptions
51
50
Timeout ,
52
51
NotGiven ,
53
52
ResponseT ,
54
- Transport ,
55
53
AnyMapping ,
56
54
PostParser ,
57
- ProxiesTypes ,
58
55
RequestFiles ,
59
56
HttpxSendArgs ,
60
- AsyncTransport ,
61
57
RequestOptions ,
62
58
HttpxRequestFiles ,
63
59
ModelBuilderProtocol ,
@@ -339,9 +335,6 @@ class BaseClient(Generic[_HttpxClientT, _DefaultStreamT]):
339
335
_base_url : URL
340
336
max_retries : int
341
337
timeout : Union [float , Timeout , None ]
342
- _limits : httpx .Limits
343
- _proxies : ProxiesTypes | None
344
- _transport : Transport | AsyncTransport | None
345
338
_strict_response_validation : bool
346
339
_idempotency_header : str | None
347
340
_default_stream_cls : type [_DefaultStreamT ] | None = None
@@ -354,19 +347,13 @@ def __init__(
354
347
_strict_response_validation : bool ,
355
348
max_retries : int = DEFAULT_MAX_RETRIES ,
356
349
timeout : float | Timeout | None = DEFAULT_TIMEOUT ,
357
- limits : httpx .Limits ,
358
- transport : Transport | AsyncTransport | None ,
359
- proxies : ProxiesTypes | None ,
360
350
custom_headers : Mapping [str , str ] | None = None ,
361
351
custom_query : Mapping [str , object ] | None = None ,
362
352
) -> None :
363
353
self ._version = version
364
354
self ._base_url = self ._enforce_trailing_slash (URL (base_url ))
365
355
self .max_retries = max_retries
366
356
self .timeout = timeout
367
- self ._limits = limits
368
- self ._proxies = proxies
369
- self ._transport = transport
370
357
self ._custom_headers = custom_headers or {}
371
358
self ._custom_query = custom_query or {}
372
359
self ._strict_response_validation = _strict_response_validation
@@ -802,46 +789,11 @@ def __init__(
802
789
base_url : str | URL ,
803
790
max_retries : int = DEFAULT_MAX_RETRIES ,
804
791
timeout : float | Timeout | None | NotGiven = NOT_GIVEN ,
805
- transport : Transport | None = None ,
806
- proxies : ProxiesTypes | None = None ,
807
- limits : Limits | None = None ,
808
792
http_client : httpx .Client | None = None ,
809
793
custom_headers : Mapping [str , str ] | None = None ,
810
794
custom_query : Mapping [str , object ] | None = None ,
811
795
_strict_response_validation : bool ,
812
796
) -> 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
-
845
797
if not is_given (timeout ):
846
798
# if the user passed in a custom http client with a non-default
847
799
# timeout set then we use that timeout.
@@ -862,12 +814,9 @@ def __init__(
862
814
863
815
super ().__init__ (
864
816
version = version ,
865
- limits = limits ,
866
817
# cast to a valid type because mypy doesn't understand our type narrowing
867
818
timeout = cast (Timeout , timeout ),
868
- proxies = proxies ,
869
819
base_url = base_url ,
870
- transport = transport ,
871
820
max_retries = max_retries ,
872
821
custom_query = custom_query ,
873
822
custom_headers = custom_headers ,
@@ -877,9 +826,6 @@ def __init__(
877
826
base_url = base_url ,
878
827
# cast to a valid type because mypy doesn't understand our type narrowing
879
828
timeout = cast (Timeout , timeout ),
880
- limits = limits ,
881
- follow_redirects = True ,
882
- ** kwargs , # type: ignore
883
829
)
884
830
885
831
def is_closed (self ) -> bool :
@@ -1389,45 +1335,10 @@ def __init__(
1389
1335
_strict_response_validation : bool ,
1390
1336
max_retries : int = DEFAULT_MAX_RETRIES ,
1391
1337
timeout : float | Timeout | None | NotGiven = NOT_GIVEN ,
1392
- transport : AsyncTransport | None = None ,
1393
- proxies : ProxiesTypes | None = None ,
1394
- limits : Limits | None = None ,
1395
1338
http_client : httpx .AsyncClient | None = None ,
1396
1339
custom_headers : Mapping [str , str ] | None = None ,
1397
1340
custom_query : Mapping [str , object ] | None = None ,
1398
1341
) -> 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
-
1431
1342
if not is_given (timeout ):
1432
1343
# if the user passed in a custom http client with a non-default
1433
1344
# timeout set then we use that timeout.
@@ -1449,11 +1360,8 @@ def __init__(
1449
1360
super ().__init__ (
1450
1361
version = version ,
1451
1362
base_url = base_url ,
1452
- limits = limits ,
1453
1363
# cast to a valid type because mypy doesn't understand our type narrowing
1454
1364
timeout = cast (Timeout , timeout ),
1455
- proxies = proxies ,
1456
- transport = transport ,
1457
1365
max_retries = max_retries ,
1458
1366
custom_query = custom_query ,
1459
1367
custom_headers = custom_headers ,
@@ -1463,9 +1371,6 @@ def __init__(
1463
1371
base_url = base_url ,
1464
1372
# cast to a valid type because mypy doesn't understand our type narrowing
1465
1373
timeout = cast (Timeout , timeout ),
1466
- limits = limits ,
1467
- follow_redirects = True ,
1468
- ** kwargs , # type: ignore
1469
1374
)
1470
1375
1471
1376
def is_closed (self ) -> bool :
0 commit comments