from ._auth import Auth, BasicAuth, FunctionAuth
from ._config import (
+ DEFAULT_LIMITS,
DEFAULT_MAX_REDIRECTS,
- DEFAULT_POOL_LIMITS,
DEFAULT_TIMEOUT_CONFIG,
UNSET,
- PoolLimits,
+ Limits,
Proxy,
Timeout,
UnsetType,
get_logger,
same_origin,
should_not_be_proxied,
+ warn_deprecated,
)
logger = get_logger(__name__)
URLs.
* **timeout** - *(optional)* The timeout configuration to use when sending
requests.
- * **pool_limits** - *(optional)* The connection pool configuration to use
- when determining the maximum number of concurrently open HTTP connections.
+ * **limits** - *(optional)* The limits configuration to use.
* **max_redirects** - *(optional)* The maximum number of redirect responses
that should be followed.
* **base_url** - *(optional)* A URL to use as the base when building
http2: bool = False,
proxies: ProxiesTypes = None,
timeout: TimeoutTypes = DEFAULT_TIMEOUT_CONFIG,
- pool_limits: PoolLimits = DEFAULT_POOL_LIMITS,
+ limits: Limits = DEFAULT_LIMITS,
+ pool_limits: Limits = None,
max_redirects: int = DEFAULT_MAX_REDIRECTS,
base_url: URLTypes = None,
transport: httpcore.SyncHTTPTransport = None,
trust_env=trust_env,
)
+ if pool_limits is not None:
+ warn_deprecated(
+ "Client(..., pool_limits=...) is deprecated and will raise "
+ "errors in the future. Use Client(..., limits=...) instead."
+ )
+ limits = pool_limits
+
proxy_map = self._get_proxy_map(proxies, trust_env)
self._transport = self._init_transport(
verify=verify,
cert=cert,
http2=http2,
- pool_limits=pool_limits,
+ limits=limits,
transport=transport,
app=app,
trust_env=trust_env,
verify=verify,
cert=cert,
http2=http2,
- pool_limits=pool_limits,
+ limits=limits,
trust_env=trust_env,
)
for key, proxy in proxy_map.items()
verify: VerifyTypes = True,
cert: CertTypes = None,
http2: bool = False,
- pool_limits: PoolLimits = DEFAULT_POOL_LIMITS,
+ limits: Limits = DEFAULT_LIMITS,
transport: httpcore.SyncHTTPTransport = None,
app: typing.Callable = None,
trust_env: bool = True,
return httpcore.SyncConnectionPool(
ssl_context=ssl_context,
- max_keepalive=pool_limits.max_keepalive,
- max_connections=pool_limits.max_connections,
+ max_keepalive=limits.max_keepalive,
+ max_connections=limits.max_connections,
keepalive_expiry=KEEPALIVE_EXPIRY,
http2=http2,
)
verify: VerifyTypes = True,
cert: CertTypes = None,
http2: bool = False,
- pool_limits: PoolLimits = DEFAULT_POOL_LIMITS,
+ limits: Limits = DEFAULT_LIMITS,
trust_env: bool = True,
) -> httpcore.SyncHTTPTransport:
ssl_context = create_ssl_context(verify=verify, cert=cert, trust_env=trust_env)
proxy_headers=proxy.headers.raw,
proxy_mode=proxy.mode,
ssl_context=ssl_context,
- max_keepalive=pool_limits.max_keepalive,
- max_connections=pool_limits.max_connections,
+ max_keepalive=limits.max_keepalive,
+ max_connections=limits.max_connections,
keepalive_expiry=KEEPALIVE_EXPIRY,
http2=http2,
)
URLs.
* **timeout** - *(optional)* The timeout configuration to use when sending
requests.
- * **pool_limits** - *(optional)* The connection pool configuration to use
- when determining the maximum number of concurrently open HTTP connections.
+ * **limits** - *(optional)* The limits configuration to use.
* **max_redirects** - *(optional)* The maximum number of redirect responses
that should be followed.
* **base_url** - *(optional)* A URL to use as the base when building
http2: bool = False,
proxies: ProxiesTypes = None,
timeout: TimeoutTypes = DEFAULT_TIMEOUT_CONFIG,
- pool_limits: PoolLimits = DEFAULT_POOL_LIMITS,
+ limits: Limits = DEFAULT_LIMITS,
+ pool_limits: Limits = None,
max_redirects: int = DEFAULT_MAX_REDIRECTS,
base_url: URLTypes = None,
transport: httpcore.AsyncHTTPTransport = None,
trust_env=trust_env,
)
+ if pool_limits is not None:
+ warn_deprecated(
+ "AsyncClient(..., pool_limits=...) is deprecated and will raise "
+ "errors in the future. Use AsyncClient(..., limits=...) instead."
+ )
+ limits = pool_limits
+
proxy_map = self._get_proxy_map(proxies, trust_env)
self._transport = self._init_transport(
verify=verify,
cert=cert,
http2=http2,
- pool_limits=pool_limits,
+ limits=limits,
transport=transport,
app=app,
trust_env=trust_env,
verify=verify,
cert=cert,
http2=http2,
- pool_limits=pool_limits,
+ limits=limits,
trust_env=trust_env,
)
for key, proxy in proxy_map.items()
verify: VerifyTypes = True,
cert: CertTypes = None,
http2: bool = False,
- pool_limits: PoolLimits = DEFAULT_POOL_LIMITS,
+ limits: Limits = DEFAULT_LIMITS,
transport: httpcore.AsyncHTTPTransport = None,
app: typing.Callable = None,
trust_env: bool = True,
return httpcore.AsyncConnectionPool(
ssl_context=ssl_context,
- max_keepalive=pool_limits.max_keepalive,
- max_connections=pool_limits.max_connections,
+ max_keepalive=limits.max_keepalive,
+ max_connections=limits.max_connections,
keepalive_expiry=KEEPALIVE_EXPIRY,
http2=http2,
)
verify: VerifyTypes = True,
cert: CertTypes = None,
http2: bool = False,
- pool_limits: PoolLimits = DEFAULT_POOL_LIMITS,
+ limits: Limits = DEFAULT_LIMITS,
trust_env: bool = True,
) -> httpcore.AsyncHTTPTransport:
ssl_context = create_ssl_context(verify=verify, cert=cert, trust_env=trust_env)
proxy_headers=proxy.headers.raw,
proxy_mode=proxy.mode,
ssl_context=ssl_context,
- max_keepalive=pool_limits.max_keepalive,
- max_connections=pool_limits.max_connections,
+ max_keepalive=limits.max_keepalive,
+ max_connections=limits.max_connections,
keepalive_expiry=KEEPALIVE_EXPIRY,
http2=http2,
)