Add documentation for requests.Session compatibility (#449)

This commit is contained in:
Jt Miclat 2019-10-06 08:20:18 +08:00 committed by Seth Michael Larson
parent fc3df514e8
commit 31730e7095
2 changed files with 16 additions and 2 deletions

View File

@ -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/')

View File

@ -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).