(HandlerClass=BaseHTTPRequestHandler,
         ServerClass=ThreadingHTTPServer,
         protocol="HTTP/1.0", port=8000, bind=None)
Test the HTTP request handler class.

    This runs an HTTP server on port 8000 (or the port argument).
Test the HTTP request handler class.
Test the HTTP request handler class .
def test(HandlerClass=BaseHTTPRequestHandler,
         ServerClass=ThreadingHTTPServer,
         protocol="HTTP/1.0", port=8000, bind=None):
    """Test the HTTP request handler class.

    This runs an HTTP server on port 8000 (or the port argument).

    """
    ServerClass.address_family, addr = _get_best_family(bind, port)

    HandlerClass.protocol_version = protocol
    with ServerClass(addr, HandlerClass) as httpd:
        host, port = httpd.socket.getsockname()[:2]
        url_host = f'[{host}]' if ':' in host else host
        print(
            f"Serving HTTP on {host} port {port} "
            f"(http://{url_host}:{port}/) ..."
        )
        try:
            httpd.serve_forever()
        except KeyboardInterrupt:
            print("\nKeyboard interrupt received, exiting.")
            sys.exit(0)
def test ( HandlerClass = BaseHTTPRequestHandler , ServerClass = ThreadingHTTPServer , protocol = "HTTP/1.0" , port = 8000 , bind = None ) : ServerClass . address_family , addr = _get_best_family ( bind , port ) HandlerClass . protocol_version = protocol with ServerClass ( addr , HandlerClass ) as httpd : host , port = httpd . socket . getsockname ( ) [ : 2 ] url_host = f'[{host}]' if ':' in host else host print ( f"Serving HTTP on {host} port {port} " f"(http://{url_host}:{port}/) ..." ) try : httpd . serve_forever ( ) except KeyboardInterrupt : print ( "\nKeyboard interrupt received, exiting." ) sys . exit ( 0 )