Skip to content
Myr

Document pool_limits and SSL context on verify (#942)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Yeray Diaz Diaz · committed by GitHub · parent d6b3794 · Browse files · 2 files+29 added−2 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Trailers

  • Co-authored-by: Tom Christie <tom@tomchristie.com>

Diff stats

2 files+29 added−2 removed

  • other:+29 added−2 removed

2 files+29 added−2 removed

modified:docs/advanced.md+28 added-1 removed
397 unmodified lines
398399response = client.get('http://example.com/')400```401402## Pool limit configuration403404You can control the connection pool size using the `pool_limits` keyword405argument on the client. It takes instances of `httpx.PoolLimits` which define:406407- `soft_limit`, number of allowable keep-alive connections, or `None` to always408allow. (Defaults 10)409- `hard_limit`, maximum number of allowable connections, or` None` for no limits.410(Default 100)411412413```python414limits = httpx.PoolLimits(soft_limit=5, hard_limit=10)415client = httpx.Client(pool_limits=limits)416```417418## Multipart file encoding419420As mentioned in the [quickstart](/quickstart#sending-multipart-file-uploads)421multipart file encoding is available by passing a dictionary with the
151 unmodified lines
573574r = httpx.get("https://example.org", verify="path/to/client.pem")575```576561You can also disable the SSL verification...577Alternatively, you can pass a standard library `ssl.SSLContext`.578579```python580>>> import ssl581>>> import httpx582>>> context = ssl.create_default_context()583>>> context.load_verify_locations(cafile="/tmp/client.pem")584>>> httpx.get('https://example.org', verify=context)585<Response [200 OK]>586```587588Or you can also disable the SSL verification entirely, which is _not_ recommended.589590```python591import httpx592593r = httpx.get("https://example.org", verify=False)594```
27 unmodified lines
modified:httpx/_config.py+1 added-1 removed
288 unmodified lines
289 **Parameters:**290291 * **soft_limit** - Allow the connection pool to maintain keep-alive connections292 below this point.293 * **hard_limit** - The maximum number of concurrenct connections that may be293 * **hard_limit** - The maximum number of concurrent connections that may be294 established.295 """296297 def __init__(
60 unmodified lines