From 354e13a2a5f71ea8366f4db681e936e00d0dad85 Mon Sep 17 00:00:00 2001 From: Lysandros Nikolaou Date: Sun, 28 Oct 2018 23:10:52 +0100 Subject: [PATCH 1/3] Update urllib documentation to include the context parameter in urlretrieve --- Doc/library/urllib.rst | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Doc/library/urllib.rst b/Doc/library/urllib.rst index c24f4375e9d80f..00a0f5b9b1b70b 100644 --- a/Doc/library/urllib.rst +++ b/Doc/library/urllib.rst @@ -154,7 +154,7 @@ High-level interface of :func:`urllib2.urlopen`. -.. function:: urlretrieve(url[, filename[, reporthook[, data]]]) +.. function:: urlretrieve(url[, filename[, reporthook[, data[, context]]]]) Copy a network object denoted by a URL to a local file, if necessary. If the URL points to a local file, or a valid cached copy of the object exists, the object @@ -179,6 +179,10 @@ High-level interface :mimetype:`application/x-www-form-urlencoded` format; see the :func:`urlencode` function below. + The *context* parameter may be set to a :class:`ssl.SSLContext` instance to + configure the SSL settings that are used if :func:`urlretrieve` makes a HTTPS + connection. + .. versionchanged:: 2.5 :func:`urlretrieve` will raise :exc:`ContentTooShortError` when it detects that the amount of data available was less than the expected amount (which is the @@ -196,6 +200,9 @@ High-level interface the size of the data it has downloaded, and just returns it. In this case you just have to assume that the download was successful. + .. versionchanged:: 2.7.9 + The *context* parameter was added. All the neccessary certificate and hostname checks are done by default. + .. data:: _urlopener From 63cbcaee4d28c127944966c2612e837dc9e0babb Mon Sep 17 00:00:00 2001 From: Lysandros Nikolaou Date: Mon, 29 Oct 2018 14:21:19 +0100 Subject: [PATCH 2/3] Wrap line around column #79 as is done throughout the file --- Doc/library/urllib.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Doc/library/urllib.rst b/Doc/library/urllib.rst index 00a0f5b9b1b70b..256a1b758ffe7e 100644 --- a/Doc/library/urllib.rst +++ b/Doc/library/urllib.rst @@ -201,7 +201,8 @@ High-level interface just have to assume that the download was successful. .. versionchanged:: 2.7.9 - The *context* parameter was added. All the neccessary certificate and hostname checks are done by default. + The *context* parameter was added. All the neccessary certificate and hostname + checks are done by default. .. data:: _urlopener From 0e60144605531fb7ffddc792944e8fe208a8f634 Mon Sep 17 00:00:00 2001 From: Lysandros Nikolaou Date: Wed, 31 Oct 2018 20:26:44 +0100 Subject: [PATCH 3/3] Two spaces after period, versionchanged in URLopener --- Doc/library/urllib.rst | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Doc/library/urllib.rst b/Doc/library/urllib.rst index 256a1b758ffe7e..084d567e5e2ef3 100644 --- a/Doc/library/urllib.rst +++ b/Doc/library/urllib.rst @@ -147,7 +147,8 @@ High-level interface :envvar:`no_proxy` environment variable. .. versionchanged:: 2.7.9 - The *context* parameter was added. All the neccessary certificate and hostname checks are done by default. + The *context* parameter was added. All the neccessary certificate and hostname + checks are done by default. .. deprecated:: 2.6 The :func:`urlopen` function has been removed in Python 3 in favor @@ -201,7 +202,7 @@ High-level interface just have to assume that the download was successful. .. versionchanged:: 2.7.9 - The *context* parameter was added. All the neccessary certificate and hostname + The *context* parameter was added. All the neccessary certificate and hostname checks are done by default. @@ -357,6 +358,10 @@ URL Opener objects :class:`URLopener` objects will raise an :exc:`IOError` exception if the server returns an error code. + .. versionchanged:: 2.7.9 + The *context* parameter was added. All the neccessary certificate and hostname + checks are done by default. + .. method:: open(fullurl[, data]) Open *fullurl* using the appropriate protocol. This method sets up cache and