httpx/docs/advanced/resource-limits.md
Tom Christie 8cd952c88f
Docs restructuring. (#3049)
* Tweak docs layout

* Move client docs into folder

* Add clients/authentication section

* Client authentication docs

* Fix authentication example

* SSL Context

* Timeouts

* Event hooks

* Proxies, Transports

* Text encodings

* Resource limits

* 'Clients' -> 'Advanced'

* 'Clients' -> 'Advanced'

* Add client docs

---------

Co-authored-by: Kar Petrosyan <92274156+karpetrosyan@users.noreply.github.com>
2024-01-15 09:48:56 +00:00

596 B

You can control the connection pool size using the limits keyword argument on the client. It takes instances of httpx.Limits which define:

  • max_keepalive_connections, number of allowable keep-alive connections, or None to always allow. (Defaults 20)
  • max_connections, maximum number of allowable connections, or None for no limits. (Default 100)
  • keepalive_expiry, time limit on idle keep-alive connections in seconds, or None for no limits. (Default 5)
limits = httpx.Limits(max_keepalive_connections=5, max_connections=10)
client = httpx.Client(limits=limits)