diff options
author | Senthil Kumaran <orsenthil@gmail.com> | 2008-06-23 04:41:59 (GMT) |
---|---|---|
committer | Senthil Kumaran <orsenthil@gmail.com> | 2008-06-23 04:41:59 (GMT) |
commit | aca8fd7a9dc96143e592076fab4d89cc1691d03f (patch) | |
tree | f18d273e3f72b917139e07f3e6e4d72a5119fd94 /Doc/library/urllib.error.rst | |
parent | d11a44312f2e80a9c4979063ce94233f924dcc5b (diff) | |
download | cpython-aca8fd7a9dc96143e592076fab4d89cc1691d03f.zip cpython-aca8fd7a9dc96143e592076fab4d89cc1691d03f.tar.gz cpython-aca8fd7a9dc96143e592076fab4d89cc1691d03f.tar.bz2 |
Documentation updates for urllib package. Modified the documentation for the
urllib,urllib2 -> urllib.request,urllib.error
urlparse -> urllib.parse
RobotParser -> urllib.robotparser
Updated tutorial references and other module references (http.client.rst,
ftplib.rst,contextlib.rst)
Updated the examples in the urllib2-howto
Addresses Issue3142.
Diffstat (limited to 'Doc/library/urllib.error.rst')
-rw-r--r-- | Doc/library/urllib.error.rst | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/Doc/library/urllib.error.rst b/Doc/library/urllib.error.rst new file mode 100644 index 0000000..1cbfe7d --- /dev/null +++ b/Doc/library/urllib.error.rst @@ -0,0 +1,48 @@ +:mod:`urllib.error` --- Exception classes raised by urllib.request +================================================================== + +.. module:: urllib.error + :synopsis: Next generation URL opening library. +.. moduleauthor:: Jeremy Hylton <jhylton@users.sourceforge.net> +.. sectionauthor:: Senthil Kumaran <orsenthil@gmail.com> + + +The :mod:`urllib.error` module defines exception classes raise by +urllib.request. The base exception class is URLError, which inherits from +IOError. + +The following exceptions are raised by :mod:`urllib.error` as appropriate: + + +.. exception:: URLError + + The handlers raise this exception (or derived exceptions) when they run into a + problem. It is a subclass of :exc:`IOError`. + + .. attribute:: reason + + The reason for this error. It can be a message string or another exception + instance (:exc:`socket.error` for remote URLs, :exc:`OSError` for local + URLs). + + +.. exception:: HTTPError + + Though being an exception (a subclass of :exc:`URLError`), an :exc:`HTTPError` + can also function as a non-exceptional file-like return value (the same thing + that :func:`urlopen` returns). This is useful when handling exotic HTTP + errors, such as requests for authentication. + + .. attribute:: code + + An HTTP status code as defined in `RFC 2616 <http://www.faqs.org/rfcs/rfc2616.html>`_. + This numeric value corresponds to a value found in the dictionary of + codes as found in :attr:`http.server.BaseHTTPRequestHandler.responses`. + +.. exception:: ContentTooShortError(msg[, content]) + + This exception is raised when the :func:`urlretrieve` function detects that the + amount of the downloaded data is less than the expected amount (given by the + *Content-Length* header). The :attr:`content` attribute stores the downloaded + (and supposedly truncated) data. + |