From 31730e709597baaa7b2364fee041dfa985169789 Mon Sep 17 00:00:00 2001 From: Jt Miclat Date: Sun, 6 Oct 2019 08:20:18 +0800 Subject: [PATCH] Add documentation for requests.Session compatibility (#449) --- docs/advanced.md | 2 ++ docs/compatibility.md | 16 ++++++++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) 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). -- 2.47.3