]> git.ipfire.org Git - thirdparty/httpx.git/commitdiff
docs: Fix proxy examples (#2183)
authornyuszika7h <nyuszika7h@gmail.com>
Thu, 5 May 2022 12:11:18 +0000 (14:11 +0200)
committerGitHub <noreply@github.com>
Thu, 5 May 2022 12:11:18 +0000 (13:11 +0100)
Per https://www.python-httpx.org/compatibility/#proxy-keys, there should
always be a `://` after the protocol. The given examples raise an
exception when used as-is.

Co-authored-by: Florimond Manca <florimond.manca@protonmail.com>
Co-authored-by: Tom Christie <tom@tomchristie.com>
docs/contributing.md
docs/troubleshooting.md

index 74472575c3b4dd8f22823ed5578b9f560e975a90..1d44616f7325e534eb000fa67431ef60f5ed27de 100644 (file)
@@ -213,7 +213,7 @@ this is where our previously generated `client.pem` comes in:
 ```
 import httpx
 
-proxies = {"all": "http://127.0.0.1:8080/"}
+proxies = {"all://": "http://127.0.0.1:8080/"}
 
 with httpx.Client(proxies=proxies, verify="/path/to/client.pem") as client:
     response = client.get("https://example.org")
index 6461574974bd9ef56371ece9a69e6c2ec84d4f70..459f744edf064e0792e7a220225ada39a100cd2c 100644 (file)
@@ -20,8 +20,8 @@ httpx.ProxyError: _ssl.c:1091: The handshake operation timed out
 
 ```python
 proxies = {
-  "http": "http://myproxy.org",
-  "https": "https://myproxy.org",
+  "http://": "http://myproxy.org",
+  "https://": "https://myproxy.org",
 }
 ```
 
@@ -33,8 +33,8 @@ Change the scheme of your HTTPS proxy to `http://...` instead of `https://...`:
 
 ```python
 proxies = {
-  "http": "http://myproxy.org",
-  "https": "http://myproxy.org",
+  "http://": "http://myproxy.org",
+  "https://": "http://myproxy.org",
 }
 ```