Info Node: (python2.1-lib.info)OpenerDirector Objects
(python2.1-lib.info)OpenerDirector Objects
OpenerDirector Objects
----------------------
`OpenerDirector' instances have the following methods:
`add_handler(handler)'
HANDLER should be an instance of `BaseHandler'. The following
methods are searched, and added to the possible chains.
* `PROTOCOL_open()' -- signal that the handler knows how to
open PROTOCOL URLs.
* `PROTOCOL_error_TYPE()' -- signal that the handler knows how
to handle TYPE errors from PROTOCOL.
`close()'
Explicitly break cycles, and delete all the handlers. Because the
`OpenerDirector' needs to know the registered handlers, and a
handler needs to know who the `OpenerDirector' who called it is,
there is a reference cycles. Even though recent versions of Python
have cycle-collection, it is sometimes preferable to explicitly
break the cycles.
`open(url[, data])'
Open the given URL. (which can be a request object or a string),
optionally passing the given DATA. Arguments, return values and
exceptions raised are the same as those of `urlopen()' (which
simply calls the `open()' method on the default installed
`OpenerDirector'.
`error(proto[, arg[, ...]])'
Handle an error in a given protocol. The HTTP protocol is special
cased to use the code as the error. This will call the registered
error handlers for the given protocol with the given arguments
(which are protocol specific).
Return values and exceptions raised are the same as those of
`urlopen()'.