From: Jt Miclat Date: Sun, 6 Oct 2019 00:20:18 +0000 (+0800) Subject: Add documentation for requests.Session compatibility (#449) X-Git-Tag: 0.7.5~9 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F455%2Fhead;p=thirdparty%2Fhttpx.git Add documentation for requests.Session compatibility (#449) --- diff --git a/docs/advanced.md b/docs/advanced.md index 8a16be64..f4a6835b 100644 --- a/docs/advanced.md +++ b/docs/advanced.md @@ -6,6 +6,8 @@ Using a Client instance to make requests will give you HTTP connection pooling, will provide cookie persistence, and allows you to apply configuration across all outgoing requests. +A Client instance is equivalent to a Session instance in `requests`. + ```python >>> client = httpx.Client() >>> r = client.get('https://example.org/') diff --git a/docs/compatibility.md b/docs/compatibility.md index d748ddd2..50a6682c 100644 --- a/docs/compatibility.md +++ b/docs/compatibility.md @@ -17,5 +17,17 @@ but also provide lower-cased versions for API compatibility with `requests`. ## Advanced Usage -!!! warning - TODO +### requests.Session +The HTTPX equivalent of `requests.Session` is `httpx.Client`. + +```python +session = requests.Session(**kwargs) +``` + +is equivalent to + +```python +client = httpx.Client(**kwargs) +``` + +More detailed documentation and usage of `Client` can be found in [Advanced Usage](advanced.md).