Fix sections references (#3058)
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by Kar Petrosyan · committed by GitHub · parent 419d3a9 · Browse files · 10 files·+22 added−22 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
10 files+22 added−22 removed
- other:+22 added−22 removed
Provenance
- Commit
73e6888- Tree
c1d66c8- Author
Kar Petrosyan <92274156+karpetrosyan@users.noreply.github.com>- Committer
GitHub <noreply@github.com>- Parent
419d3a9
10 files changed+22 added−22 removed
modified:docs/advanced/clients.md+7 added-7 removed
6 unmodified lines7 If you do anything more than experimentation, one-off scripts, or prototypes, then you should use a `Client` instance.8 9 **More efficient usage of network resources**10 11-When you make requests using the top-level API as documented in the [Quickstart](quickstart.md) guide, HTTPX has to establish a new connection _for every single request_ (connections are not reused). As the number of requests to a host increases, this quickly becomes inefficient.11+When you make requests using the top-level API as documented in the [Quickstart](../quickstart.md) guide, HTTPX has to establish a new connection _for every single request_ (connections are not reused). As the number of requests to a host increases, this quickly becomes inefficient.12 13 On the other hand, a `Client` instance uses [HTTP connection pooling](https://en.wikipedia.org/wiki/HTTP_persistent_connection). This means that when you make several requests to the same host, the `Client` will reuse the underlying TCP connection, instead of recreating one for every single request.14 15 This can bring **significant performance improvements** compared to using the top-level API, including:8 unmodified lines24 25 - Cookie persistence across requests.26 - Applying configuration across all outgoing requests.27 - Sending requests through HTTP proxies.28-- Using [HTTP/2](http2.md).28+- Using [HTTP/2](../http2.md).29 30 The other sections on this page go into further detail about what you can do with a `Client` instance.31 32 ## Usage26 unmodified lines59 >>> r60 <Response [200 OK]>61 ```62 63-These methods accept the same arguments as `httpx.get()`, `httpx.post()`, etc. This means that all features documented in the [Quickstart](quickstart.md) guide are also available at the client level.63+These methods accept the same arguments as `httpx.get()`, `httpx.post()`, etc. This means that all features documented in the [Quickstart](../quickstart.md) guide are also available at the client level.64 65 For example, to send a request with custom headers:66 67 ```pycon70 unmodified lines138 >>> r.request.url139 URL('http://httpbin.org/headers')140 ```141 142-For a list of all available client parameters, see the [`Client`](api.md#client) API reference.142+For a list of all available client parameters, see the [`Client`](../api.md#client) API reference.143 144 ---145 146 ## Request instances147 148-For maximum control on what gets sent over the wire, HTTPX supports building explicit [`Request`](api.md#request) instances:148+For maximum control on what gets sent over the wire, HTTPX supports building explicit [`Request`](../api.md#request) instances:149 150 ```python151 request = httpx.Request("GET", "https://example.com")152 ```49 unmodified lines202 progress.update(response.num_bytes_downloaded - num_bytes_downloaded)203 num_bytes_downloaded = response.num_bytes_downloaded204 ```205 206-206+207 208 Or an alternate example, this time using the [`rich`](https://github.com/willmcgugan/rich) library…209 210 ```python53 unmodified lines264 265 266 ## Multipart file encoding267 268-As mentioned in the [quickstart](quickstart.md#sending-multipart-file-uploads)268+As mentioned in the [quickstart](../quickstart.md#sending-multipart-file-uploads)269 multipart file encoding is available by passing a dictionary with the270 name of the payloads as keys and either tuple of elements or a file-like object or a string as values.271 272 ```pycon52 unmodified linesmodified:docs/advanced/proxies.md+1 added-1 removed
61 unmodified lines6263646566666768697013 unmodified lines61 unmodified lines* **Tunnelling**: the proxy establishes a TCP connection to the server on your behalf, and the client reuses this connection to send the request and receive the response. This is known as an [HTTP Tunnel](https://en.wikipedia.org/wiki/HTTP_tunnel). This mechanism is how you can access websites that use HTTPS from an HTTP proxy (the client "upgrades" the connection to HTTPS by performing the TLS handshake with the server over the TCP connection provided by the proxy).
### Troubleshooting proxies
If you encounter issues when setting up proxies, please refer to our [Troubleshooting guide](troubleshooting.md#proxies).If you encounter issues when setting up proxies, please refer to our [Troubleshooting guide](../troubleshooting.md#proxies).
## SOCKS
In addition to HTTP proxies, `httpcore` also supports proxies using the SOCKS protocol.13 unmodified linesmodified:docs/advanced/transports.md+1 added-1 removed
339 unmodified lines340 341 There are also environment variables that can be used to control the dictionary of the client mounts. 342 They can be used to configure HTTP proxying for clients.343 344-See documentation on [`HTTP_PROXY`, `HTTPS_PROXY`, `ALL_PROXY`](environment_variables.md#http_proxy-https_proxy-all_proxy) for more information.344+See documentation on [`HTTP_PROXY`, `HTTPS_PROXY`, `ALL_PROXY`](../environment_variables.md#http_proxy-https_proxy-all_proxy) for more information.modified:docs/async.md+1 added-1 removed
82 unmodified lines83 * `Response.aiter_lines()` - For streaming the response content as lines of text.84 * `Response.aiter_raw()` - For streaming the raw response bytes, without applying content decoding.85 * `Response.aclose()` - For closing the response. You don't usually need this, since `.stream` block closes the response automatically on exit.86 87-For situations when context block usage is not practical, it is possible to enter "manual mode" by sending a [`Request` instance](./advanced.md#request-instances) using `client.send(..., stream=True)`.87+For situations when context block usage is not practical, it is possible to enter "manual mode" by sending a [`Request` instance](advanced/clients.md#request-instances) using `client.send(..., stream=True)`.88 89 Example in the context of forwarding the response to a streaming web endpoint with [Starlette](https://www.starlette.io):90 91 ```python153 unmodified linesmodified:docs/compatibility.md+4 added-4 removed
157 unmodified lines158 ## Proxy keys159 160 HTTPX uses the mounts argument for HTTP proxying and transport routing.161 It can do much more than proxies and allows you to configure more than just the proxy route.162-For more detailed documentation, see [Mounting Transports](advanced.md#mounting-transports).162+For more detailed documentation, see [Mounting Transports](advanced/transports.md#mounting-transports).163 164 When using `httpx.Client(mounts={...})` to map to a selection of different transports, we use full URL schemes, such as `mounts={"http://": ..., "https://": ...}`.165 166 This is different to the `requests` usage of `proxies={"http": ..., "https": ...}`.29 unmodified lines196 We don't support `response.is_ok` since the naming is ambiguous there, and might incorrectly imply an equivalence to `response.status_code == codes.OK`. Instead we provide the `response.is_success` property, which can be used to check for a 2xx response.197 198 ## Request instantiation199 200-There is no notion of [prepared requests](https://requests.readthedocs.io/en/stable/user/advanced/#prepared-requests) in HTTPX. If you need to customize request instantiation, see [Request instances](advanced.md#request-instances).200+There is no notion of [prepared requests](https://requests.readthedocs.io/en/stable/user/advanced/#prepared-requests) in HTTPX. If you need to customize request instantiation, see [Request instances](advanced/clients.md#request-instances).201 202-Besides, `httpx.Request()` does not support the `auth`, `timeout`, `follow_redirects`, `mounts`, `verify` and `cert` parameters. However these are available in `httpx.request`, `httpx.get`, `httpx.post` etc., as well as on [`Client` instances](advanced.md#client-instances).202+Besides, `httpx.Request()` does not support the `auth`, `timeout`, `follow_redirects`, `mounts`, `verify` and `cert` parameters. However these are available in `httpx.request`, `httpx.get`, `httpx.post` etc., as well as on [`Client` instances](advanced/clients.md#client-instances).203 204 ## Mocking205 206 If you need to mock HTTPX the same way that test utilities like `responses` and `requests-mock` does for `requests`, see [RESPX](https://github.com/lundberg/respx).19 unmodified lines226 `requests` allows event hooks to mutate `Request` and `Response` objects. See [examples](https://requests.readthedocs.io/en/master/user/advanced/#event-hooks) given in the documentation for `requests`.227 228 In HTTPX, event hooks may access properties of requests and responses, but event hook callbacks cannot mutate the original request/response.229 230-If you are looking for more control, consider checking out [Custom Transports](advanced.md#custom-transports).230+If you are looking for more control, consider checking out [Custom Transports](advanced/transports.md#custom-transports).modified:docs/environment_variables.md+1 added-1 removed
73 unmodified lines7475767778787980818231 unmodified lines73 unmodified lines
* [cURL](https://github.com/curl/curl/blob/master/docs/MANUAL.md#environment-variables)* [requests](https://github.com/psf/requests/blob/master/docs/user/advanced.rst#proxies)
For more information on using proxies in HTTPX, see [HTTP Proxying](advanced.md#http-proxying).For more information on using proxies in HTTPX, see [HTTP Proxying](advanced/proxies.md#http-proxying).
### `HTTP_PROXY`, `HTTPS_PROXY`, `ALL_PROXY`
Valid values: A URL to a proxy31 unmodified linesmodified:docs/index.md+2 added-2 removed
66 unmodified lines67 68 * A broadly [requests-compatible API](compatibility.md).69 * Standard synchronous interface, but with [async support if you need it](async.md).70 * HTTP/1.1 [and HTTP/2 support](http2.md).71-* Ability to make requests directly to [WSGI applications](advanced.md#calling-into-python-web-apps) or [ASGI applications](async.md#calling-into-python-web-apps).71+* Ability to make requests directly to [WSGI applications](async.md#calling-into-python-web-apps) or [ASGI applications](async.md#calling-into-python-web-apps).72 * Strict timeouts everywhere.73 * Fully type annotated.74 * 100% test coverage.75 18 unmodified lines94 ## Documentation95 96 For a run-through of all the basics, head over to the [QuickStart](quickstart.md).97 98-For more advanced topics, see the [Advanced Usage](advanced.md) section,98+For more advanced topics, see the **Advanced** section,99 the [async support](async.md) section, or the [HTTP/2](http2.md) section.100 101 The [Developer Interface](api.md) provides a comprehensive API reference.102 47 unmodified linesmodified:docs/quickstart.md+1 added-1 removed
460 unmodified lines461 ```pycon462 >>> httpx.get('https://github.com/', timeout=None)463 ```464 465-For advanced timeout management, see [Timeout fine-tuning](advanced.md#fine-tuning-the-configuration).465+For advanced timeout management, see [Timeout fine-tuning](advanced/timeouts.md#fine-tuning-the-configuration).466 467 ## Authentication468 469 HTTPX supports Basic and Digest HTTP authentication.73 unmodified linesmodified:docs/third_party_packages.md+2 added-2 removed
26 unmodified lines27 ### HTTPX-Auth28 29 [GitHub](https://github.com/Colin-b/httpx_auth) - [Documentation](https://colin-b.github.io/httpx_auth/)30 31-Provides authentication classes to be used with HTTPX [authentication parameter](advanced.md#customizing-authentication).31+Provides authentication classes to be used with HTTPX [authentication parameter](advanced/authentication.md#customizing-authentication).32 33 ### pytest-HTTPX34 35 [GitHub](https://github.com/Colin-b/pytest_httpx) - [Documentation](https://colin-b.github.io/pytest_httpx/)43 unmodified lines79 ### urllib3-transport80 81 [GitHub](https://gist.github.com/florimondmanca/d56764d78d748eb9f73165da388e546e)82 83-This public gist provides an example implementation for a [custom transport](advanced.md#custom-transports) implementation on top of the battle-tested [`urllib3`](https://urllib3.readthedocs.io) library.83+This public gist provides an example implementation for a [custom transport](advanced/transports.md#custom-transports) implementation on top of the battle-tested [`urllib3`](https://urllib3.readthedocs.io) library.modified:docs/troubleshooting.md+2 added-2 removed
25 unmodified lines26 ```27 28 Using this setup, you're telling HTTPX to connect to the proxy using HTTP for HTTP requests, and using HTTPS for HTTPS requests.29 30-But if you get the error above, it is likely that your proxy doesn't support connecting via HTTPS. Don't worry: that's a [common gotcha](advanced.md#example).30+But if you get the error above, it is likely that your proxy doesn't support connecting via HTTPS. Don't worry: that's a [common gotcha](advanced/proxies.md#http-proxies).31 32 Change the scheme of your HTTPS proxy to `http://...` instead of `https://...`:33 34 ```python10 unmodified lines45 with httpx.Client(proxy=proxy) as client:46 ...47 ```48 49-For more information, see [Proxies: FORWARD vs TUNNEL](advanced.md#forward-vs-tunnel).49+For more information, see [Proxies: FORWARD vs TUNNEL](advanced/proxies.md#forward-vs-tunnel).50 51 ---52 53 ### Error when making requests to an HTTPS proxy10 unmodified lines