vinegar.request_handler¶
Sub modules¶
Request handler that serves files from the file systems. |
|
Request handler that allows for making changes to an SQLite database. |
Module API¶
Handlers that handle HTTP or TFTP requests.
Different handlers can be used for different purposes. The most common one is
the vinegar.request_handler.file handler, which can serve resources from the
file system.
All handler modules have in common that they must specify a
get_instance_http or get_instance_tftp function (or both). Each of these
functions takes a dict with configuration data as its only argument. These
functions must return an instance of HttpRequestHandler or
TftpRequestHandler. The key name in that configuration dict is
reserved for use by the calling code and should be ignored by the request
handler.
Request handlers are thread safe.
-
vinegar.request_handler.get_http_request_handler(name: str, config: Mapping[Any, Any]) → vinegar.http.server.HttpRequestHandler¶ Create an instance of the HTTP request handler with the specified name, using the specified configuration.
- Parameters
name – name of the request handler. If the name contains a dot, it is treated as an absolute module name. Otherwise it is treated as a name of one of the modules inside the
vinegar.request_handlermodule.- Param
config: configuration data for the request handler. The meaning of that data is up to the implementation of the request handler.
- Returns
newly created HTTP request handler.
-
vinegar.request_handler.get_tftp_request_handler(name: str, config: Mapping[Any, Any]) → vinegar.tftp.server.TftpRequestHandler¶ Create an instance of the TFP request handler with the specified name, using the specified configuration.
- Parameters
name – name of the request handler. If the name contains a dot, it is treated as an absolute module name. Otherwise it is treated as a name of one of the modules inside the
vinegar.request_handlermodule.- Param
config: configuration data for the request handler. The meaning of that data is up to the implementation of the request handler.
- Returns
newly created TFTP request handler.