Networking and Internet Modules

http.server

HTTP request handlers and server classes for local development and controlled demonstrations. A handler dispatches requests to methods such as do_GET. The module is not recommended as a production server; avoid exposing demonstration servers or sensitive files.

Formal Syntax & Structure

python syntaxpython
import http.server

Return Value

module

Module namespace available through import; import is a statement, not a value-returning expression.

Working Example

Example Snippetpython
from http.server import BaseHTTPRequestHandlerprint(BaseHTTPRequestHandler.responses[404][0])
Python Reference