Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(62214)

Side by Side Diff: Doc/library/urllib.request.rst

Issue 22417: PEP 476: verify HTTPS certificates by default
Patch Set: Created 4 years, 7 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Doc/library/http.client.rst ('k') | Doc/library/xmlrpc.client.rst » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 :mod:`urllib.request` --- Extensible library for opening URLs 1 :mod:`urllib.request` --- Extensible library for opening URLs
2 ============================================================= 2 =============================================================
3 3
4 .. module:: urllib.request 4 .. module:: urllib.request
5 :synopsis: Extensible library for opening URLs. 5 :synopsis: Extensible library for opening URLs.
6 .. moduleauthor:: Jeremy Hylton <jeremy@alum.mit.edu> 6 .. moduleauthor:: Jeremy Hylton <jeremy@alum.mit.edu>
7 .. sectionauthor:: Moshe Zadka <moshez@users.sourceforge.net> 7 .. sectionauthor:: Moshe Zadka <moshez@users.sourceforge.net>
8 .. sectionauthor:: Senthil Kumaran <senthil@uthcode.com> 8 .. sectionauthor:: Senthil Kumaran <senthil@uthcode.com>
9 9
10 10
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 The optional *cafile* and *capath* parameters specify a set of trusted 54 The optional *cafile* and *capath* parameters specify a set of trusted
55 CA certificates for HTTPS requests. *cafile* should point to a single 55 CA certificates for HTTPS requests. *cafile* should point to a single
56 file containing a bundle of CA certificates, whereas *capath* should 56 file containing a bundle of CA certificates, whereas *capath* should
57 point to a directory of hashed certificate files. More information can 57 point to a directory of hashed certificate files. More information can
58 be found in :meth:`ssl.SSLContext.load_verify_locations`. 58 be found in :meth:`ssl.SSLContext.load_verify_locations`.
59 59
60 The *cadefault* parameter specifies whether to fall back to loading a 60 The *cadefault* parameter specifies whether to fall back to loading a
61 default certificate store defined by the underlying OpenSSL library if the 61 default certificate store defined by the underlying OpenSSL library if the
62 *cafile* and *capath* parameters are omitted. This will only work on 62 *cafile* and *capath* parameters are omitted. This will only work on
63 some non-Windows platforms. 63 some non-Windows platforms.
64
65 .. warning::
66 If neither *cafile* nor *capath* is specified, and *cadefault* is ``False` `,
67 an HTTPS request will not do any verification of the server's
68 certificate.
69 64
70 For http and https urls, this function returns a 65 For http and https urls, this function returns a
71 :class:`http.client.HTTPResponse` object which has the following 66 :class:`http.client.HTTPResponse` object which has the following
72 :ref:`httpresponse-objects` methods. 67 :ref:`httpresponse-objects` methods.
73 68
74 For ftp, file, and data urls and requests explicitly handled by legacy 69 For ftp, file, and data urls and requests explicitly handled by legacy
75 :class:`URLopener` and :class:`FancyURLopener` classes, this function 70 :class:`URLopener` and :class:`FancyURLopener` classes, this function
76 returns a :class:`urllib.response.addinfourl` object which can work as 71 returns a :class:`urllib.response.addinfourl` object which can work as
77 :term:`context manager` and has methods such as 72 :term:`context manager` and has methods such as
78 73
(...skipping 29 matching lines...) Expand all
108 .. versionchanged:: 3.2 103 .. versionchanged:: 3.2
109 HTTPS virtual hosts are now supported if possible (that is, if 104 HTTPS virtual hosts are now supported if possible (that is, if
110 :data:`ssl.HAS_SNI` is true). 105 :data:`ssl.HAS_SNI` is true).
111 106
112 .. versionadded:: 3.2 107 .. versionadded:: 3.2
113 *data* can be an iterable object. 108 *data* can be an iterable object.
114 109
115 .. versionchanged:: 3.3 110 .. versionchanged:: 3.3
116 *cadefault* was added. 111 *cadefault* was added.
117 112
118 .. versionchanged:: 3.5 113 .. versionchanged:: 3.4.3
119 *context* was added. 114 *context* was added, and this function now performs all the necessary cert ificate and hostname checks by default for *https* URLS.
120 115
121 116
122 .. function:: install_opener(opener) 117 .. function:: install_opener(opener)
123 118
124 Install an :class:`OpenerDirector` instance as the default global opener. 119 Install an :class:`OpenerDirector` instance as the default global opener.
125 Installing an opener is only necessary if you want urlopen to use that 120 Installing an opener is only necessary if you want urlopen to use that
126 opener; otherwise, simply call :meth:`OpenerDirector.open` instead of 121 opener; otherwise, simply call :meth:`OpenerDirector.open` instead of
127 :func:`~urllib.request.urlopen`. The code does not check for a real 122 :func:`~urllib.request.urlopen`. The code does not check for a real
128 :class:`OpenerDirector`, and any class with the appropriate interface will 123 :class:`OpenerDirector`, and any class with the appropriate interface will
129 work. 124 work.
(...skipping 1320 matching lines...) Expand 10 before | Expand all | Expand 10 after
1450 .. module:: urllib.response 1445 .. module:: urllib.response
1451 :synopsis: Response classes used by urllib. 1446 :synopsis: Response classes used by urllib.
1452 1447
1453 The :mod:`urllib.response` module defines functions and classes which define a 1448 The :mod:`urllib.response` module defines functions and classes which define a
1454 minimal file like interface, including ``read()`` and ``readline()``. The 1449 minimal file like interface, including ``read()`` and ``readline()``. The
1455 typical response object is an addinfourl instance, which defines an ``info()`` 1450 typical response object is an addinfourl instance, which defines an ``info()``
1456 method and that returns headers and a ``geturl()`` method that returns the url. 1451 method and that returns headers and a ``geturl()`` method that returns the url.
1457 Functions defined by this module are used internally by the 1452 Functions defined by this module are used internally by the
1458 :mod:`urllib.request` module. 1453 :mod:`urllib.request` module.
1459 1454
OLDNEW
« no previous file with comments | « Doc/library/http.client.rst ('k') | Doc/library/xmlrpc.client.rst » ('j') | no next file with comments »

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+