Skip to content

Commit a5fff19

Browse files
docs(readme): example snippet for client context manager (#550)
1 parent aa2ca67 commit a5fff19

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

README.md

+10
Original file line numberDiff line numberDiff line change
@@ -407,6 +407,16 @@ client.with_options(http_client=DefaultHttpxClient(...))
407407

408408
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.
409409

410+
```py
411+
from finch import Finch
412+
413+
with Finch() as client:
414+
# make requests here
415+
...
416+
417+
# HTTP client is now closed
418+
```
419+
410420
## Versioning
411421

412422
This package generally follows [SemVer](https://semver.org/spec/v2.0.0.html) conventions, though certain backwards-incompatible changes may be released as minor versions:

0 commit comments

Comments
 (0)