Skip to content

Commit

Permalink
chore(docs): document how to do per-request http client customization (
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-app[bot] committed Jul 18, 2024
1 parent 8f8abe4 commit 9cc6de4
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,12 @@ client = Anthropic(
)
```

You can also customize the client on a per-request basis by using `with_options()`:

```python
client.with_options(http_client=DefaultHttpxClient(...))
```

### Managing HTTP resources

By default the library closes underlying HTTP connections whenever the client is [garbage collected](https://docs.python.org/3/reference/datamodel.html#object.__del__). You can manually close the client using the `.close()` method if desired, or with a context manager that closes when exiting.
Expand Down

0 comments on commit 9cc6de4

Please sign in to comment.