Skip to content
Myr

async recommendations (#2727)

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

* async recommendations * better * Update docs/async.md Co-authored-by: Tom Christie <tom@tomchristie.com> * added async recommendation tweak ---------

authored by Trond Hindenes · committed by GitHub · parent 920333e · Browse files · 1 file+3 added−0 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

1 file+3 added−0 removed

  • other:+3 added−0 removed

1 file+3 added−0 removed

modified:docs/async.md+3 added
51 unmodified lines
52async with httpx.AsyncClient() as client:53 ...54```5556!!! warning57In order to get the most benefit from connection pooling, make sure you're not instantiating multiple client instances - for example by using `async with` inside a "hot loop". This can be achieved either by having a single scoped client that's passed throughout wherever it's needed, or by having a single global client instance.5859Alternatively, use `await client.aclose()` if you want to close a client explicitly:6061```python62client = httpx.AsyncClient()
182 unmodified lines