Skip to content

Commit 354e13a

Browse files
committed
Update urllib documentation to include the context parameter in urlretrieve
1 parent 05acd44 commit 354e13a

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

Doc/library/urllib.rst

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ High-level interface
154154
of :func:`urllib2.urlopen`.
155155

156156

157-
.. function:: urlretrieve(url[, filename[, reporthook[, data]]])
157+
.. function:: urlretrieve(url[, filename[, reporthook[, data[, context]]]])
158158

159159
Copy a network object denoted by a URL to a local file, if necessary. If the URL
160160
points to a local file, or a valid cached copy of the object exists, the object
@@ -179,6 +179,10 @@ High-level interface
179179
:mimetype:`application/x-www-form-urlencoded` format; see the :func:`urlencode`
180180
function below.
181181

182+
The *context* parameter may be set to a :class:`ssl.SSLContext` instance to
183+
configure the SSL settings that are used if :func:`urlretrieve` makes a HTTPS
184+
connection.
185+
182186
.. versionchanged:: 2.5
183187
:func:`urlretrieve` will raise :exc:`ContentTooShortError` when it detects that
184188
the amount of data available was less than the expected amount (which is the
@@ -196,6 +200,9 @@ High-level interface
196200
the size of the data it has downloaded, and just returns it. In this case you
197201
just have to assume that the download was successful.
198202

203+
.. versionchanged:: 2.7.9
204+
The *context* parameter was added. All the neccessary certificate and hostname checks are done by default.
205+
199206

200207
.. data:: _urlopener
201208

0 commit comments

Comments
 (0)