]> git.ipfire.org Git - thirdparty/httpx.git/commitdiff
Add netrc environment variable into the documentation (#1675)
authorMei <55642867+meist0731@users.noreply.github.com>
Wed, 16 Jun 2021 05:04:47 +0000 (00:04 -0500)
committerGitHub <noreply@github.com>
Wed, 16 Jun 2021 05:04:47 +0000 (07:04 +0200)
* Adding netrc environment variable documentation

* Update docs/environment_variables.md

Co-authored-by: Tom Christie <tom@tomchristie.com>
* Modifications about netrcfile environment variable

* Change uppercase "A" in netrcfile env variable into lowercase

* Added some words and a dot before "my_netrc" in the console example

* changed a typo "rather that" into "rather than" in advanced.md

* changed netrc environment variable in example part

* modified title for netrc environment variable part in doc

* Deleted the dot in title of netrc environment variable

Co-authored-by: Tom Christie <tom@tomchristie.com>
docs/advanced.md
docs/environment_variables.md

index 32714bd5a2d4a8af7642cdd461831c961eccc735..cf8cc51311320fe2f1ec46ce42fe61355f72bcff 100644 (file)
@@ -370,7 +370,7 @@ password example-password
 ...
 ```
 
-When using `Client` instances, `trust_env` should be set on the client itself, rather that on the request methods:
+When using `Client` instances, `trust_env` should be set on the client itself, rather than on the request methods:
 
 ```python
 client = httpx.Client(trust_env=False)
index d9cc89a58fffef75f0314d8cd3889c4a6a5b45e6..b0ebcf0cc31e20dc403cfcb8a41630133d7afcb6 100644 (file)
@@ -132,6 +132,18 @@ Example:
 SSL_CERT_DIR=/path/to/ca-certs/ python -c "import httpx; httpx.get('https://example.com')"
 ```
 
+## `NETRC`
+
+Valid values: a filename
+
+If this environment variable is set but auth parameter is not defined, HTTPX will add auth information stored in the .netrc file into the request's header. If you do not provide NETRC environment either, HTTPX will use default files. (~/.netrc, ~/_netrc)
+
+Example:
+
+```console
+NETRC=/path/to/netrcfile/.my_netrc python -c "import httpx; httpx.get('https://example.com')"
+```
+
 ## Proxies
 
 The environment variables documented below are used as a convention by various HTTP tooling, including:
@@ -175,3 +187,4 @@ python -c "import httpx; httpx.get('http://example.com')"
 python -c "import httpx; httpx.get('http://127.0.0.1:5000/my-api')"
 python -c "import httpx; httpx.get('https://www.python-httpx.org')"
 ```
+