Skip to content

Commit 30ae872

Browse files
docs(readme): example snippet for client context manager (#139)
1 parent fc58a7d commit 30ae872

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -412,6 +412,16 @@ client.with_options(http_client=DefaultHttpxClient(...))
412412

413413
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.
414414

415+
```py
416+
from writerai import Writer
417+
418+
with Writer() as client:
419+
# make requests here
420+
...
421+
422+
# HTTP client is now closed
423+
```
424+
415425
## Versioning
416426

417427
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)