BaseHandler objects provide a couple of methods that are directly useful, and others that are meant to be used by derived classes. These are intended for direct use:
The following members and methods should only be used by classes derived from BaseHandler:
This method, if implemented, will be called by the parent
OpenerDirector. It should return a file-like object as
described in the return value of the open() of
OpenerDirector, or None
. It should raise
URLError, unless a truly exceptional thing happens (for
example, MemoryError should not be mapped to
URLError).
This method will be called before any protocol-specific open method.
This method, if defined, will be called by the parent OpenerDirector. Return values should be the same as for default_open().
This method, if implemented, will be called by the parent OpenerDirector. Return values should be the same as for default_open().
req will be a Request object, fp will be a file-like object with the HTTP error body, code will be the three-digit code of the error, msg will be the user-visible explanation of the code and hdrs will be a mapping object with the headers of the error.
Return values and exceptions raised should be the same as those of urlopen().
Subclasses should override this method to handle specific HTTP errors.
Arguments, return values and exceptions raised should be the same as for http_error_default().
See About this document... for information on suggesting changes.