Add persistent examples

This commit is contained in:
Richard van den Berg
2016-08-26 09:43:11 +02:00
parent 52b15f811f
commit 2cd05271be
+10
View File
@@ -208,6 +208,11 @@ You can pass ``verify`` the path to a CA_BUNDLE file or directory with certifica
>>> requests.get('https://github.com', verify='/path/to/certfile')
or persistent::
s = requests.Session()
s.verify = '/path/to/certfile'
.. note:: If ``verify`` is set to a path to a directory, the directory must have been processed using
the c_rehash utility supplied with OpenSSL.
@@ -227,6 +232,11 @@ file's path::
>>> requests.get('https://kennethreitz.com', cert=('/path/client.cert', '/path/client.key'))
<Response [200]>
or persistent::
s = requests.Session()
s.cert = '/path/client.cert'
If you specify a wrong path or an invalid cert, you'll get a SSLError::
>>> requests.get('https://kennethreitz.com', cert='/wrong_path/client.pem')