backport context argument of urlopen (#22366) for pep 476

This commit is contained in:
Senthil Kumaran 2014-09-19 15:23:30 +08:00
parent cc23154d02
commit 8b7e161ac3
4 changed files with 29 additions and 2 deletions

View file

@ -16,7 +16,7 @@ authentication, redirections, cookies and more.
The :mod:`urllib.request` module defines the following functions:
.. function:: urlopen(url, data=None[, timeout], *, cafile=None, capath=None, cadefault=False)
.. function:: urlopen(url, data=None[, timeout], *, cafile=None, capath=None, cadefault=False, context=None)
Open the URL *url*, which can be either a string or a
:class:`Request` object.
@ -47,6 +47,10 @@ The :mod:`urllib.request` module defines the following functions:
the global default timeout setting will be used). This actually
only works for HTTP, HTTPS and FTP connections.
If *context* is specified, it must be a :class:`ssl.SSLContext` instance
describing the various SSL options. See
:class:`~http.client.HTTPSConnection` for more details.
The optional *cafile* and *capath* parameters specify a set of trusted
CA certificates for HTTPS requests. *cafile* should point to a single
file containing a bundle of CA certificates, whereas *capath* should
@ -111,6 +115,9 @@ The :mod:`urllib.request` module defines the following functions:
.. versionchanged:: 3.3
*cadefault* was added.
.. versionchanged:: 3.4.3
*context* was added.
.. function:: install_opener(opener)
Install an :class:`OpenerDirector` instance as the default global opener.