Skip to content
Myr

Added docs for using client-side ssl certificates (#1570)

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

* Added docs for using client-side ssl certificates * Update docs/advanced.md Co-authored-by: Joe <nigelchiang@outlook.com> * Update docs/advanced.md Co-authored-by: Joe <nigelchiang@outlook.com> * Update docs/advanced.md * Update docs/advanced.md * Update docs/advanced.md

authored by Hemanth kumar · committed by GitHub · parent eb7433b · Browse files · 1 file+26 added−0 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: Hemanth <hemanth@actionfi.com>
  • Co-authored-by: Tom Christie <tom@tomchristie.com>
  • Co-authored-by: Joe <nigelchiang@outlook.com>

Diff stats

1 file+26 added−0 removed

  • other:+26 added−0 removed

1 file+26 added−0 removed

modified:docs/advanced.md+26 added
943 unmodified lines
944```945946The `client.get(...)` method and other request methods *do not* support changing the SSL settings on a per-request basis. If you need different SSL settings in different cases you should use more that one client instance, with different settings on each. Each client will then be using an isolated connection pool with a specific fixed SSL configuration on all connections within that pool.947948### Client Side Certificates949950You can also specify a local cert to use as a client-side certificate, either a path to an SSL certificate file, or two-tuple of (certificate file, key file), or a three-tuple of (certificate file, key file, password)951952```python953import httpx954955r = httpx.get("https://example.org", cert="path/to/client.pem")956```957958Alternatively,959960```pycon961>>> cert = ("path/to/client.pem", "path/to/client.key")962>>> httpx.get("https://example.org", cert=cert)963<Response [200 OK]>964```965966or967968```pycon969>>> cert = ("path/to/client.pem", "path/to/client.key", "password")970>>> httpx.get("https://example.org", cert=cert)971<Response [200 OK]>972```973974### Making HTTPS requests to a local server975976When making requests to local servers, such as a development server running on `localhost`, you will typically be using unencrypted HTTP connections.977
198 unmodified lines