Document digest auth (#348)
* Document authentication * Fix linting errors * Tweak wording * Update docs/quickstart.md Co-Authored-By: Florimond Manca <florimond.manca@gmail.com>
This commit is contained in:
parent
6c6148ec5c
commit
8155352d20
@ -56,7 +56,7 @@ Plus all the standard features of `requests`...
|
||||
* Keep-Alive & Connection Pooling
|
||||
* Sessions with Cookie Persistence
|
||||
* Browser-style SSL Verification
|
||||
* Basic/Digest Authentication *(Digest is still TODO)*
|
||||
* Basic/Digest Authentication
|
||||
* Elegant Key/Value Cookies
|
||||
* Automatic Decompression
|
||||
* Automatic Content Decoding
|
||||
|
||||
@ -379,3 +379,25 @@ value to be more or less strict:
|
||||
```python
|
||||
>>> httpx.get('https://github.com/', timeout=0.001)
|
||||
```
|
||||
|
||||
## Authentication
|
||||
|
||||
HTTPX supports Basic and Digest HTTP authentication.
|
||||
|
||||
To provide Basic authentication credentials, pass a 2-tuple of
|
||||
plaintext `str` or `bytes` objects as the `auth` argument to the request
|
||||
functions:
|
||||
|
||||
```python
|
||||
>>> httpx.get("https://example.com", auth=("my_user", "password123"))
|
||||
```
|
||||
|
||||
To provide credentials for Digest authentication you'll need to instantiate
|
||||
a `DigestAuth` object with the plaintext username and password as arguments.
|
||||
This object can be then passed as the `auth` argument to the request methods
|
||||
as above:
|
||||
|
||||
```python
|
||||
>>> auth = httpx.DigestAuth("my_user", "password123")
|
||||
>>> httpx.get("https://example.com", auth=auth)
|
||||
<Response [200 OK]>
|
||||
|
||||
@ -11,7 +11,7 @@ combine_as_imports = True
|
||||
force_grid_wrap = 0
|
||||
include_trailing_comma = True
|
||||
known_first_party = httpx,tests
|
||||
known_third_party = brotli,certifi,chardet,cryptography,h11,h2,hstspreload,nox,pytest,rfc3986,setuptools,trustme,uvicorn
|
||||
known_third_party = brotli,certifi,chardet,cryptography,h11,h2,hstspreload,nox,pytest,requests,rfc3986,setuptools,trustme,uvicorn
|
||||
line_length = 88
|
||||
multi_line_output = 3
|
||||
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
"""Test compatibility with the Requests high-level API."""
|
||||
import pytest
|
||||
|
||||
import requests
|
||||
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user