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 ,
@@ -338,9 +334,6 @@ class BaseClient(Generic[_HttpxClientT, _DefaultStreamT]):
338
334
_base_url : URL
339
335
max_retries : int
340
336
timeout : Union [float , Timeout , None ]
341
- _limits : httpx .Limits
342
- _proxies : ProxiesTypes | None
343
- _transport : Transport | AsyncTransport | None
344
337
_strict_response_validation : bool
345
338
_idempotency_header : str | None
346
339
_default_stream_cls : type [_DefaultStreamT ] | None = None
@@ -353,19 +346,13 @@ def __init__(
353
346
_strict_response_validation : bool ,
354
347
max_retries : int = DEFAULT_MAX_RETRIES ,
355
348
timeout : float | Timeout | None = DEFAULT_TIMEOUT ,
356
- limits : httpx .Limits ,
357
- transport : Transport | AsyncTransport | None ,
358
- proxies : ProxiesTypes | None ,
359
349
custom_headers : Mapping [str , str ] | None = None ,
360
350
custom_query : Mapping [str , object ] | None = None ,
361
351
) -> None :
362
352
self ._version = version
363
353
self ._base_url = self ._enforce_trailing_slash (URL (base_url ))
364
354
self .max_retries = max_retries
365
355
self .timeout = timeout
366
- self ._limits = limits
367
- self ._proxies = proxies
368
- self ._transport = transport
369
356
self ._custom_headers = custom_headers or {}
370
357
self ._custom_query = custom_query or {}
371
358
self ._strict_response_validation = _strict_response_validation
@@ -801,46 +788,11 @@ def __init__(
801
788
base_url : str | URL ,
802
789
max_retries : int = DEFAULT_MAX_RETRIES ,
803
790
timeout : float | Timeout | None | NotGiven = NOT_GIVEN ,
804
- transport : Transport | None = None ,
805
- proxies : ProxiesTypes | None = None ,
806
- limits : Limits | None = None ,
807
791
http_client : httpx .Client | None = None ,
808
792
custom_headers : Mapping [str , str ] | None = None ,
809
793
custom_query : Mapping [str , object ] | None = None ,
810
794
_strict_response_validation : bool ,
811
795
) -> 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
-
844
796
if not is_given (timeout ):
845
797
# if the user passed in a custom http client with a non-default
846
798
# timeout set then we use that timeout.
@@ -861,12 +813,9 @@ def __init__(
861
813
862
814
super ().__init__ (
863
815
version = version ,
864
- limits = limits ,
865
816
# cast to a valid type because mypy doesn't understand our type narrowing
866
817
timeout = cast (Timeout , timeout ),
867
- proxies = proxies ,
868
818
base_url = base_url ,
869
- transport = transport ,
870
819
max_retries = max_retries ,
871
820
custom_query = custom_query ,
872
821
custom_headers = custom_headers ,
@@ -876,9 +825,6 @@ def __init__(
876
825
base_url = base_url ,
877
826
# cast to a valid type because mypy doesn't understand our type narrowing
878
827
timeout = cast (Timeout , timeout ),
879
- limits = limits ,
880
- follow_redirects = True ,
881
- ** kwargs , # type: ignore
882
828
)
883
829
884
830
def is_closed (self ) -> bool :
@@ -1388,45 +1334,10 @@ def __init__(
1388
1334
_strict_response_validation : bool ,
1389
1335
max_retries : int = DEFAULT_MAX_RETRIES ,
1390
1336
timeout : float | Timeout | None | NotGiven = NOT_GIVEN ,
1391
- transport : AsyncTransport | None = None ,
1392
- proxies : ProxiesTypes | None = None ,
1393
- limits : Limits | None = None ,
1394
1337
http_client : httpx .AsyncClient | None = None ,
1395
1338
custom_headers : Mapping [str , str ] | None = None ,
1396
1339
custom_query : Mapping [str , object ] | None = None ,
1397
1340
) -> 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
-
1430
1341
if not is_given (timeout ):
1431
1342
# if the user passed in a custom http client with a non-default
1432
1343
# timeout set then we use that timeout.
@@ -1448,11 +1359,8 @@ def __init__(
1448
1359
super ().__init__ (
1449
1360
version = version ,
1450
1361
base_url = base_url ,
1451
- limits = limits ,
1452
1362
# cast to a valid type because mypy doesn't understand our type narrowing
1453
1363
timeout = cast (Timeout , timeout ),
1454
- proxies = proxies ,
1455
- transport = transport ,
1456
1364
max_retries = max_retries ,
1457
1365
custom_query = custom_query ,
1458
1366
custom_headers = custom_headers ,
@@ -1462,9 +1370,6 @@ def __init__(
1462
1370
base_url = base_url ,
1463
1371
# cast to a valid type because mypy doesn't understand our type narrowing
1464
1372
timeout = cast (Timeout , timeout ),
1465
- limits = limits ,
1466
- follow_redirects = True ,
1467
- ** kwargs , # type: ignore
1468
1373
)
1469
1374
1470
1375
def is_closed (self ) -> bool :
0 commit comments