(*handlers)
return opener
Create an opener object from a list of handlers.

    The opener will use several default handlers, including support
    for HTTP, FTP and when applicable HTTPS.

    If any of the handlers passed as arguments are subclasses of the
    default handlers, the default handlers will not be used.
Create an opener object from a list of handlers.
Create an opener object from a list of handlers .
def build_opener(*handlers):
    """Create an opener object from a list of handlers.

    The opener will use several default handlers, including support
    for HTTP, FTP and when applicable HTTPS.

    If any of the handlers passed as arguments are subclasses of the
    default handlers, the default handlers will not be used.
    """
    opener = OpenerDirector()
    default_classes = [ProxyHandler, UnknownHandler, HTTPHandler,
                       HTTPDefaultErrorHandler, HTTPRedirectHandler,
                       FTPHandler, FileHandler, HTTPErrorProcessor,
                       DataHandler]
    if hasattr(http.client, "HTTPSConnection"):
        default_classes.append(HTTPSHandler)
    skip = set()
    for klass in default_classes:
        for check in handlers:
            if isinstance(check, type):
                if issubclass(check, klass):
                    skip.add(klass)
            elif isinstance(check, klass):
                skip.add(klass)
    for klass in skip:
        default_classes.remove(klass)

    for klass in default_classes:
        opener.add_handler(klass())

    for h in handlers:
        if isinstance(h, type):
            h = h()
        opener.add_handler(h)
    return opener
def build_opener ( * handlers ) : opener = OpenerDirector ( ) default_classes = [ ProxyHandler , UnknownHandler , HTTPHandler , HTTPDefaultErrorHandler , HTTPRedirectHandler , FTPHandler , FileHandler , HTTPErrorProcessor , DataHandler ] if hasattr ( http . client , "HTTPSConnection" ) : default_classes . append ( HTTPSHandler ) skip = set ( ) for klass in default_classes : for check in handlers : if isinstance ( check , type ) : if issubclass ( check , klass ) : skip . add ( klass ) elif isinstance ( check , klass ) : skip . add ( klass ) for klass in skip : default_classes . remove ( klass ) for klass in default_classes : opener . add_handler ( klass ( ) ) for h in handlers : if isinstance ( h , type ) : h = h ( ) opener . add_handler ( h ) return opener