Skip to content
Myr

advanced: use "client.*" to designate client certificate

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

Using "server.crt" is confusing as one may try to put the server certificate while this is really the client certificate that should be put here. Instead, use "client.cert", "client.key" and "client.pem".

authored by Vincent Bernat · committed by Vincent Bernat · parent a1c9b84 · Browse files · 1 file+2 added−2 removed
This commit

State

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

Diff stats

1 file+2 added−2 removed

  • other:+2 added−2 removed

1 file+2 added−2 removed

modified:docs/user/advanced.rst+2 added-2 removed
218 unmodified lines
219You can also specify a local cert to use as client side certificate, as a single220file (containing the private key and the certificate) or as a tuple of both221file's path::222223 >>> requests.get('https://kennethreitz.com', cert=('/path/server.crt', '/path/key'))223 >>> requests.get('https://kennethreitz.com', cert=('/path/client.cert', '/path/client.key'))224 <Response [200]>225226If you specify a wrong path or an invalid cert::227228 >>> requests.get('https://kennethreitz.com', cert='/wrong_path/server.pem')228 >>> requests.get('https://kennethreitz.com', cert='/wrong_path/client.pem')229 SSLError: [Errno 336265225] _ssl.c:347: error:140B0009:SSL routines:SSL_CTX_use_PrivateKey_file:PEM lib230231.. _ca-certificates:232
663 unmodified lines