Skip to content
Myr

Edited documentation about proxy-envs usage (#404) (#1257)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

* Edited documentation about proxy-envs usage (#404) * PR review (#404) Co-authored-by: Florimond Manca <florimond.manca@gmail.com> * PR review (#404) Co-authored-by: Florimond Manca <florimond.manca@gmail.com> * Fix typo

authored by cdeler · committed by GitHub · parent 98bb548 · Browse files · 1 file+33 added−4 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Trailers

  • Co-authored-by: Florimond Manca <florimond.manca@gmail.com>

Diff stats

1 file+33 added−4 removed

  • other:+33 added−4 removed

1 file+33 added−4 removed

modified:docs/environment_variables.md+33 added-4 removed
132 unmodified lines
133```console134SSL_CERT_DIR=/path/to/ca-certs/ python -c "import httpx; httpx.get('https://example.com')"135```136137## `HTTP_PROXY`, `HTTPS_PROXY`, `ALL_PROXY`137## Proxies138139The environment variables documented below are used as a convention by various HTTP tooling, including:140141* [cURL](https://github.com/curl/curl/blob/master/docs/MANUAL.md#environment-variables)142* [requests](https://github.com/psf/requests/blob/master/docs/user/advanced.rst#proxies)143144For more information on using proxies in HTTPX, see [HTTP Proxying](/advanced/#http-proxying).145146### `HTTP_PROXY`, `HTTPS_PROXY`, `ALL_PROXY`147148Valid values: A URL to a proxy149141Sets the proxy to be used for `http`, `https`, or all requests respectively.150`HTTP_PROXY`, `HTTPS_PROXY`, `ALL_PROXY` set the proxy to be used for `http`, `https`, or all requests respectively.151152```bash144export HTTP_PROXY=http://127.0.0.1:3080153export HTTP_PROXY=http://my-external-proxy.com:1234154155# This request will be sent through the proxy156python -c "import httpx; httpx.get('http://example.com')"157158# This request will be sent directly, as we set `trust_env=False`159python -c "import httpx; httpx.get('http://example.com', trust_env=False)"160161```162150For more information on using proxies in HTTPX, see [HTTP Proxying](/advanced/#http-proxying).163### `NO_PROXY`164165Valid values: a comma-separated list of hostnames/urls166167`NO_PROXY` disables the proxy for specific urls168169```bash170export HTTP_PROXY=http://my-external-proxy.com:1234171export NO_PROXY=http://127.0.0.1,python-httpx.org172173# As in the previous example, this request will be sent through the proxy174python -c "import httpx; httpx.get('http://example.com')"175176# These requests will be sent directly, bypassing the proxy177python -c "import httpx; httpx.get('http://127.0.0.1:5000/my-api')"178python -c "import httpx; httpx.get('https://www.python-httpx.org')"179```