Packaging dependancy tweaks (#1206)
* Remove idna and add brotli to extras * Update dependency docs * Update BrotliDecoder error message * Add nocover Co-authored-by: Tom Christie <tom@tomchristie.com>
This commit is contained in:
parent
19515e8a8b
commit
15c1e42c20
@ -119,8 +119,8 @@ The HTTPX project relies on these excellent libraries:
|
||||
* `h2` - HTTP/2 support. *(Optional)*
|
||||
* `certifi` - SSL certificates.
|
||||
* `chardet` - Fallback auto-detection for response encoding.
|
||||
* `idna` - Internationalized domain name support.
|
||||
* `rfc3986` - URL parsing & normalization.
|
||||
* `idna` - Internationalized domain name support.
|
||||
* `sniffio` - Async library autodetection.
|
||||
* `urllib3` - Support for the `httpx.URLLib3Transport` class. *(Optional)*
|
||||
* `brotlipy` - Decoding for "brotli" compressed responses. *(Optional)*
|
||||
|
||||
@ -108,11 +108,11 @@ The HTTPX project relies on these excellent libraries:
|
||||
|
||||
* `httpcore` - The underlying transport implementation for `httpx`.
|
||||
* `h11` - HTTP/1.1 support.
|
||||
* `h2` - HTTP/2 support.
|
||||
* `h2` - HTTP/2 support. *(Optional)*
|
||||
* `certifi` - SSL certificates.
|
||||
* `chardet` - Fallback auto-detection for response encoding.
|
||||
* `idna` - Internationalized domain name support.
|
||||
* `rfc3986` - URL parsing & normalization.
|
||||
* `idna` - Internationalized domain name support.
|
||||
* `sniffio` - Async library autodetection.
|
||||
* `urllib3` - Support for the `httpx.URLLib3Transport` class. *(Optional)*
|
||||
* `brotlipy` - Decoding for "brotli" compressed responses. *(Optional)*
|
||||
@ -135,6 +135,12 @@ Or, to include the optional HTTP/2 support, use:
|
||||
$ pip install httpx[http2]
|
||||
```
|
||||
|
||||
To include the optional brotli decoder support, use:
|
||||
|
||||
```shell
|
||||
$ pip install httpx[brotli]
|
||||
```
|
||||
|
||||
HTTPX requires Python 3.6+
|
||||
|
||||
[sync-support]: https://github.com/encode/httpx/issues/572
|
||||
|
||||
@ -108,9 +108,13 @@ class BrotliDecoder(Decoder):
|
||||
"""
|
||||
|
||||
def __init__(self, request: "Request") -> None:
|
||||
assert (
|
||||
brotli is not None
|
||||
), "The 'brotlipy' or 'brotli' library must be installed to use 'BrotliDecoder'"
|
||||
if brotli is None: # pragma: nocover
|
||||
raise ImportError(
|
||||
"Using 'BrotliDecoder', but the 'brotlipy' or 'brotli' library "
|
||||
"is not installed."
|
||||
"Make sure to install httpx using `pip install httpx[brotli]`."
|
||||
) from None
|
||||
|
||||
self.request = request
|
||||
self.decompressor = brotli.Decompressor()
|
||||
self.seen_data = False
|
||||
|
||||
Loading…
Reference in New Issue
Block a user