http.server.HTTPServer()
http.server.HTTPServer() is a Python function in the HTTP Server Module category. Creates an HTTP server that listens for connections and dispatches to handlers. The syntax is http.server.HTTPServer(server_address, RequestHandlerClass). Returns: HTTPServer object. A typical example: from http.server import HTTPServer, SimpleHTTPRequestHandler
server = HTTPServer(("", 8000), SimpleHTTPRequestHandler)
print("Server on port 8000")
server.serve_forever(). A close sibling is http.server.SimpleHTTPRequestHandler(), which a simple request handler that serves files from the current directory. A close sibling is http.server.BaseHTTPRequestHandler(), which base class for custom HTTP request handlers. More about this category: Simple HTTP server — HTTPServer, BaseHTTPRequestHandler, SimpleHTTPRequestHandler. Related HTTP Server Module entries: http.server.SimpleHTTPRequestHandler(), http.server.BaseHTTPRequestHandler(). This page is part of the free Python Reference documentation covering 978+ functions, methods, and modules with examples and parameter details. You can try http.server.HTTPServer() immediately in the Python playground, look up unfamiliar terms in the glossary, or return to the Python Reference homepage.