From dfdf7f309ad7cdd6e157e75d6493fc8748f503dd Mon Sep 17 00:00:00 2001 From: duzhuoshanwai Date: Fri, 21 Feb 2025 10:46:40 +0800 Subject: [PATCH] docs: Add quotes to the installation command to support special characters `pip install 'httpx[socks]'` --- README.md | 2 +- docs/advanced/proxies.md | 2 +- docs/http2.md | 2 +- docs/index.md | 4 ++-- httpx/_client.py | 4 ++-- httpx/_decoders.py | 6 +++--- httpx/_transports/default.py | 4 ++-- 7 files changed, 12 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 23992d9c24..701b635995 100644 --- a/README.md +++ b/README.md @@ -98,7 +98,7 @@ $ pip install httpx Or, to include the optional HTTP/2 support, use: ```shell -$ pip install httpx[http2] +$ pip install 'httpx[http2]' ``` HTTPX requires Python 3.8+. diff --git a/docs/advanced/proxies.md b/docs/advanced/proxies.md index 2a6b7d5f36..47c01f4f98 100644 --- a/docs/advanced/proxies.md +++ b/docs/advanced/proxies.md @@ -73,7 +73,7 @@ This is an optional feature that requires an additional third-party library be i You can install SOCKS support using `pip`: ```shell -$ pip install httpx[socks] +$ pip install 'httpx[socks]' ``` You can now configure a client to make requests via a proxy using the SOCKS protocol: diff --git a/docs/http2.md b/docs/http2.md index 3cab09d912..a865b55a26 100644 --- a/docs/http2.md +++ b/docs/http2.md @@ -28,7 +28,7 @@ trying out our HTTP/2 support. You can do so by first making sure to install the optional HTTP/2 dependencies... ```shell -$ pip install httpx[http2] +$ pip install 'httpx[http2]' ``` And then instantiating a client with HTTP/2 support enabled: diff --git a/docs/index.md b/docs/index.md index c2210bc74f..44afed508f 100644 --- a/docs/index.md +++ b/docs/index.md @@ -136,13 +136,13 @@ $ pip install httpx Or, to include the optional HTTP/2 support, use: ```shell -$ pip install httpx[http2] +$ pip install 'httpx[http2]' ``` To include the optional brotli and zstandard decoders support, use: ```shell -$ pip install httpx[brotli,zstd] +$ pip install 'httpx[brotli,zstd]' ``` HTTPX requires Python 3.8+ diff --git a/httpx/_client.py b/httpx/_client.py index 2249231f8c..3d5ef2b6a0 100644 --- a/httpx/_client.py +++ b/httpx/_client.py @@ -679,7 +679,7 @@ def __init__( except ImportError: # pragma: no cover raise ImportError( "Using http2=True, but the 'h2' package is not installed. " - "Make sure to install httpx using `pip install httpx[http2]`." + "Make sure to install httpx using `pip install 'httpx[http2]'`." ) from None allow_env_proxies = trust_env and transport is None @@ -1393,7 +1393,7 @@ def __init__( except ImportError: # pragma: no cover raise ImportError( "Using http2=True, but the 'h2' package is not installed. " - "Make sure to install httpx using `pip install httpx[http2]`." + "Make sure to install httpx using `pip install 'httpx[http2]'`." ) from None allow_env_proxies = trust_env and transport is None diff --git a/httpx/_decoders.py b/httpx/_decoders.py index 899dfada87..2120358106 100644 --- a/httpx/_decoders.py +++ b/httpx/_decoders.py @@ -120,7 +120,7 @@ def __init__(self) -> None: raise ImportError( "Using 'BrotliDecoder', but neither of the 'brotlicffi' or 'brotli' " "packages have been installed. " - "Make sure to install httpx using `pip install httpx[brotli]`." + "Make sure to install httpx using `pip install 'httpx[brotli]'`." ) from None self.decompressor = brotli.Decompressor() @@ -163,7 +163,7 @@ class ZStandardDecoder(ContentDecoder): Handle 'zstd' RFC 8878 decoding. Requires `pip install zstandard`. - Can be installed as a dependency of httpx using `pip install httpx[zstd]`. + Can be installed as a dependency of httpx using `pip install 'httpx[zstd]'`. """ # inspired by the ZstdDecoder implementation in urllib3 @@ -171,7 +171,7 @@ def __init__(self) -> None: if zstandard is None: # pragma: no cover raise ImportError( "Using 'ZStandardDecoder', ..." - "Make sure to install httpx using `pip install httpx[zstd]`." + "Make sure to install httpx using `pip install 'httpx[zstd]'`." ) from None self.decompressor = zstandard.ZstdDecompressor().decompressobj() diff --git a/httpx/_transports/default.py b/httpx/_transports/default.py index d5aa05ff23..7ff87494bc 100644 --- a/httpx/_transports/default.py +++ b/httpx/_transports/default.py @@ -190,7 +190,7 @@ def __init__( except ImportError: # pragma: no cover raise ImportError( "Using SOCKS proxy, but the 'socksio' package is not installed. " - "Make sure to install httpx using `pip install httpx[socks]`." + "Make sure to install httpx using `pip install 'httpx[socks]'`." ) from None self._pool = httpcore.SOCKSProxy( @@ -334,7 +334,7 @@ def __init__( except ImportError: # pragma: no cover raise ImportError( "Using SOCKS proxy, but the 'socksio' package is not installed. " - "Make sure to install httpx using `pip install httpx[socks]`." + "Make sure to install httpx using `pip install 'httpx[socks]'`." ) from None self._pool = httpcore.AsyncSOCKSProxy(