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 :
@@ -1387,45 +1333,10 @@ def __init__(
1387
1333
_strict_response_validation : bool ,
1388
1334
max_retries : int = DEFAULT_MAX_RETRIES ,
1389
1335
timeout : float | Timeout | None | NotGiven = NOT_GIVEN ,
1390
- transport : AsyncTransport | None = None ,
1391
- proxies : ProxiesTypes | None = None ,
1392
- limits : Limits | None = None ,
1393
1336
http_client : httpx .AsyncClient | None = None ,
1394
1337
custom_headers : Mapping [str , str ] | None = None ,
1395
1338
custom_query : Mapping [str , object ] | None = None ,
1396
1339
) -> 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
-
1429
1340
if not is_given (timeout ):
1430
1341
# if the user passed in a custom http client with a non-default
1431
1342
# timeout set then we use that timeout.
@@ -1447,11 +1358,8 @@ def __init__(
1447
1358
super ().__init__ (
1448
1359
version = version ,
1449
1360
base_url = base_url ,
1450
- limits = limits ,
1451
1361
# cast to a valid type because mypy doesn't understand our type narrowing
1452
1362
timeout = cast (Timeout , timeout ),
1453
- proxies = proxies ,
1454
- transport = transport ,
1455
1363
max_retries = max_retries ,
1456
1364
custom_query = custom_query ,
1457
1365
custom_headers = custom_headers ,
@@ -1461,9 +1369,6 @@ def __init__(
1461
1369
base_url = base_url ,
1462
1370
# cast to a valid type because mypy doesn't understand our type narrowing
1463
1371
timeout = cast (Timeout , timeout ),
1464
- limits = limits ,
1465
- follow_redirects = True ,
1466
- ** kwargs , # type: ignore
1467
1372
)
1468
1373
1469
1374
def is_closed (self ) -> bool :
0 commit comments