8000 docs(readme): example snippet for client context manager (#2280) · cloudflare/cloudflare-python@223f77d · GitHub
[go: up one dir, main page]

Skip to content
8000

Commit 223f77d

Browse files
docs(readme): example snippet for client context manager (#2280)
1 parent c14af40 commit 223f77d

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

README.md

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

378378
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.
379379

380+
```py
381+
from cloudflare import Cloudflare
382+
383+
with Cloudflare() as client:
384+
# make requests here
385+
...
386+
387+
# HTTP client is now closed
388+
```
389+
380390
## Versioning
381391

382392
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)
0