Documented netrc support (#225)
This commit is contained in:
parent
04d5ffb01b
commit
21939fdaa8
@ -65,7 +65,7 @@ Plus all the standard features of `requests`...
|
||||
* HTTP(S) Proxy Support *(TODO)*
|
||||
* Connection Timeouts
|
||||
* Streaming Downloads
|
||||
* .netrc Support *(TODO)*
|
||||
* .netrc Support
|
||||
* Chunked Requests
|
||||
|
||||
## Installation
|
||||
|
||||
@ -41,3 +41,31 @@ r = client.get('http://example/')
|
||||
assert r.status_code == 200
|
||||
assert r.text == "Hello World!"
|
||||
```
|
||||
|
||||
## .netrc Support
|
||||
|
||||
HTTPX supports .netrc file. In `trust_env=True` cases, if auth parameter is
|
||||
not defined, HTTPX tries to add auth into request's header from .netrc file.
|
||||
|
||||
As default `trust_env` is true. To set false:
|
||||
```python
|
||||
>>> httpx.get('https://example.org/', trust_env=False)
|
||||
```
|
||||
|
||||
If `NETRC` environment is empty, HTTPX tries to use default files.
|
||||
(`~/.netrc`, `~/_netrc`)
|
||||
|
||||
To change `NETRC` environment:
|
||||
```python
|
||||
>>> import os
|
||||
>>> os.environ["NETRC"] = "my_default_folder/.my_netrc"
|
||||
```
|
||||
|
||||
.netrc file content example:
|
||||
```
|
||||
machine netrcexample.org
|
||||
login example-username
|
||||
password example-password
|
||||
|
||||
...
|
||||
```
|
||||
|
||||
@ -75,7 +75,7 @@ Plus all the standard features of `requests`...
|
||||
* HTTP(S) Proxy Support *(TODO)*
|
||||
* Connection Timeouts
|
||||
* Streaming Downloads
|
||||
* .netrc Support *(TODO)*
|
||||
* .netrc Support
|
||||
* Chunked Requests
|
||||
|
||||
## Documentation
|
||||
|
||||
Loading…
Reference in New Issue
Block a user