Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

async recommendations #2727

Merged
merged 6 commits into from
Jun 15, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/async.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ Use `async with httpx.AsyncClient()` if you want a context-managed client...
async with httpx.AsyncClient() as client:
...
```
Note that there is some overhead to instantiating and terminating the client object, so it's recommended to avoid building the client using `async with` repeatedly 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.
trondhindenes marked this conversation as resolved.
Show resolved Hide resolved

Alternatively, use `await client.aclose()` if you want to close a client explicitly:

Expand Down