http.server — HTTP servers — Python 3.14.7 documentation

docs.python.org

Tin mới

socketserver — A framework for network servers

http.cookies — HTTP state management

Python Module Index

3.14.7 Documentation

The Python Standard Library

Internet Protocols and Support

WebAssembly platforms

This module does not work or is not available on WebAssembly. See WebAssembly platforms for more information.

ssl: TLS/SSL wrapper for socket objects

Subclass of HTTPServer with a wrapped socket using the ssl module. If the ssl module is not available, instantiating a HTTPSServer object fails with a RuntimeError.

http.client.parse_headers

Holds an instance of the class specified by the MessageClass class variable. This instance parses and manages the headers in the HTTP request. The parse_headers() function from http.client is used to parse the headers an

email.message.Message

Specifies an email.message.Message-like class to parse HTTP headers. Typically, this is not overridden, and it defaults to http.client.HTTPMessage.

mimetypes.guess_file_type()

This returns a string of the form type/subtype, usable for a MIME Content-type header.

Command-line interface¶

http.server can also be invoked directly using the -m switch of the interpreter. The following example illustrates how to serve files relative to the current directory: