From: Tom Christie Date: Wed, 5 Aug 2020 18:06:03 +0000 (+0100) Subject: Note on differences in proxy keys vs. `requests` (#1132) X-Git-Tag: 0.14.0~7 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3205536a095be780e0f6790883ff046a4467552b;p=thirdparty%2Fhttpx.git Note on differences in proxy keys vs. `requests` (#1132) Co-authored-by: Florimond Manca --- diff --git a/docs/compatibility.md b/docs/compatibility.md index c827f352..064486b9 100644 --- a/docs/compatibility.md +++ b/docs/compatibility.md @@ -34,6 +34,14 @@ Within a `stream()` block request data is made available with: * `.iter_raw()` - Use this instead of `response.raw` * `.read()` - Read the entire response body, making `request.text` and `response.content` available. +## Proxy keys + +When using `httpx.Client(proxies={...})` to map to a selection of different proxies, we use full URL schemes, such as `proxies={"http://": ..., "https://": ...}`. + +This is different to the `requests` usage of `proxies={"http": ..., "https": ...}`. + +This change is for better consistency with more complex mappings, that might also include domain names, such as `proxies={"all://": ..., "all://www.example.com": None}` which maps all requests onto a proxy, except for requests to "www.example.com" which have an explicit exclusion. + ## SSL configuration When using a `Client` instance, the `trust_env`, `verify`, and `cert` arguments should always be passed on client instantiation, rather than passed to the request method.