urllib.request.build_opener()

urllib.request.build_opener([handler, ...]) Return an OpenerDirector instance, which chains the handlers in the order given. handlers can be either instances of BaseHandler, or subclasses of BaseHandler (in which case it must be possible to call the constructor without any parameters). Instances of the following classes will be in front of the handlers, unless the handlers contain them, instances of them or subclasses of them: ProxyHandler (if proxy settings are detected), UnknownHandler, HT

urllib.request.BaseHandler.unknown_open()

BaseHandler.unknown_open(req) This method is not defined in BaseHandler, but subclasses should define it if they want to catch all URLs with no specific registered handler to open it. This method, if implemented, will be called by the parent OpenerDirector. Return values should be the same as for default_open().

urllib.request.BaseHandler.parent

BaseHandler.parent A valid OpenerDirector, which can be used to open using a different protocol, or handle errors.

urllib.request.BaseHandler.http_error_nnn()

BaseHandler.http_error_nnn(req, fp, code, msg, hdrs) nnn should be a three-digit HTTP error code. This method is also not defined in BaseHandler, but will be called, if it exists, on an instance of a subclass, when an HTTP error with code nnn occurs. 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().

urllib.request.BaseHandler.http_error_default()

BaseHandler.http_error_default(req, fp, code, msg, hdrs) This method is not defined in BaseHandler, but subclasses should override it if they intend to provide a catch-all for otherwise unhandled HTTP errors. It will be called automatically by the OpenerDirector getting the error, and should not normally be called in other circumstances. 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-v

urllib.request.BaseHandler.default_open()

BaseHandler.default_open(req) This method is not defined in BaseHandler, but subclasses should define it if they want to catch all URLs. 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

urllib.request.BaseHandler.close()

BaseHandler.close() Remove any parents.

urllib.request.BaseHandler.add_parent()

BaseHandler.add_parent(director) Add a director as parent.

urllib.request.BaseHandler

class urllib.request.BaseHandler This is the base class for all registered handlers — and handles only the simple mechanics of registration.

urllib.request.AbstractDigestAuthHandler.http_error_auth_reqed()

AbstractDigestAuthHandler.http_error_auth_reqed(authreq, host, req, headers) authreq should be the name of the header where the information about the realm is included in the request, host should be the host to authenticate to, req should be the (failed) Request object, and headers should be the error headers.