diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2012-11-24 16:59:08 (GMT) |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2012-11-24 16:59:08 (GMT) |
commit | df204be922b4fecc0f7316248bb2ce585e816510 (patch) | |
tree | dfb1862c578b65d07bcfd394c83375d29d81933f /Doc | |
parent | a833e0d8ae16bcb1768c7df22e3ed6e5ad35031a (diff) | |
download | cpython-df204be922b4fecc0f7316248bb2ce585e816510.zip cpython-df204be922b4fecc0f7316248bb2ce585e816510.tar.gz cpython-df204be922b4fecc0f7316248bb2ce585e816510.tar.bz2 |
Issue #16423: urllib.request now has support for ``data:`` URLs.
Patch by Mathias Panzenböck.
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/library/urllib.request.rst | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/Doc/library/urllib.request.rst b/Doc/library/urllib.request.rst index 21255e5..84c387c 100644 --- a/Doc/library/urllib.request.rst +++ b/Doc/library/urllib.request.rst @@ -121,7 +121,7 @@ The :mod:`urllib.request` module defines the following functions: instances of them or subclasses of them: :class:`ProxyHandler`, :class:`UnknownHandler`, :class:`HTTPHandler`, :class:`HTTPDefaultErrorHandler`, :class:`HTTPRedirectHandler`, :class:`FTPHandler`, :class:`FileHandler`, - :class:`HTTPErrorProcessor`. + :class:`HTTPErrorProcessor`, :class:`DataHandler`. If the Python installation has SSL support (i.e., if the :mod:`ssl` module can be imported), :class:`HTTPSHandler` will also be added. @@ -346,6 +346,11 @@ The following classes are provided: Open local files. +.. class:: DataHandler() + + Open data URLs. + + .. versionadded:: 3.4 .. class:: FTPHandler() @@ -972,6 +977,21 @@ FileHandler Objects hostname is given, an :exc:`URLError` is raised. +.. _data-handler-objects: + +DataHandler Objects +------------------- + +.. method:: DataHandler.data_open(req) + + Read a data URL. This kind of URL contains the content encoded in the URL + itself. The data URL syntax is specified in :rfc:`2397`. This implementation + ignores white spaces in base64 encoded data URLs so the URL may be wrapped + in whatever source file it comes from. But even though some browsers don't + mind about a missing padding at the end of a base64 encoded data URL, this + implementation will raise an :exc:`ValueError` in that case. + + .. _ftp-handler-objects: FTPHandler Objects @@ -1374,7 +1394,9 @@ some point in the future. pair: FTP; protocol * Currently, only the following protocols are supported: HTTP (versions 0.9 and - 1.0), FTP, and local files. + 1.0), FTP, local files, and data URLs. + + .. versionchanged:: 3.4 Added support for data URLs. * The caching feature of :func:`urlretrieve` has been disabled until someone finds the time to hack proper processing of Expiration time headers. |