Source code: Lib/urllib/error.py
The following exceptions are raised by
urllib.error as appropriate:
The handlers raise this exception (or derived exceptions) when they run into a problem. It is a subclass of
The reason for this error. It can be a message string or another exception instance.
Though being an exception (a subclass of
HTTPError can also function as a non-exceptional file-like return value (the same thing that
urlopen() returns). This is useful when handling exotic HTTP errors, such as requests for authentication.
This is usually a string explaining the reason for this error.
The HTTP response headers for the HTTP request that caused the
New in version 3.4.
exception urllib.error.ContentTooShortError(msg, content)
This exception is raised when the
urlretrieve() function detects that the amount of the downloaded data is less than the expected amount (given by the Content-Length header). The
content attribute stores the downloaded (and supposedly truncated) data.
© 2001–2020 Python Software Foundation
Licensed under the PSF License.