runtimepy.net.server package#
Subpackages#
- runtimepy.net.server.app package
- Subpackages
- Submodules
- runtimepy.net.server.app.base module
- runtimepy.net.server.app.create module
- runtimepy.net.server.app.elements module
- runtimepy.net.server.app.files module
- runtimepy.net.server.app.landing_page module
- runtimepy.net.server.app.placeholder module
- runtimepy.net.server.app.pyodide module
- runtimepy.net.server.app.sound module
- runtimepy.net.server.app.tab module
- Module contents
- runtimepy.net.server.struct package
- runtimepy.net.server.websocket package
- Submodules
- runtimepy.net.server.websocket.state module
- Module contents
RuntimepyDataWebsocketConnection
RuntimepyWebsocketConnection
RuntimepyWebsocketConnection.async_init()
RuntimepyWebsocketConnection.command
RuntimepyWebsocketConnection.disable_extra()
RuntimepyWebsocketConnection.env
RuntimepyWebsocketConnection.id_responses
RuntimepyWebsocketConnection.ids_waiting
RuntimepyWebsocketConnection.init()
RuntimepyWebsocketConnection.list_handler
RuntimepyWebsocketConnection.logger
RuntimepyWebsocketConnection.markdown
RuntimepyWebsocketConnection.outgoing_commands
RuntimepyWebsocketConnection.poll_connection_metrics
RuntimepyWebsocketConnection.poll_governor
RuntimepyWebsocketConnection.processor
RuntimepyWebsocketConnection.remote_environments
RuntimepyWebsocketConnection.remote_meta
RuntimepyWebsocketConnection.send_interfaces
RuntimepyWebsocketConnection.tab_sender()
RuntimepyWebsocketConnection.tabs
RuntimepyWebsocketConnection.ui_time
Submodules#
runtimepy.net.server.html module#
A module implementing HTML interfaces for web applications.
- async runtimepy.net.server.html.html_handler(apps: dict[str, Callable[[Html, RequestHeader, ResponseHeader, bytes | None], Awaitable[Html]]], stream: TextIO, request: RequestHeader, response: ResponseHeader, request_data: bytes | None, default_app: Callable[[Html, RequestHeader, ResponseHeader, bytes | None], Awaitable[Html]] = None) bool [source]#
Render an HTML document in response to an HTTP request.
runtimepy.net.server.json module#
A module implementing basic JSON-object response handling.
- class runtimepy.net.server.json.Encoder(*, skipkeys=False, ensure_ascii=True, check_circular=True, allow_nan=True, sort_keys=False, indent=None, separators=None, default=None)[source]#
Bases:
JSONEncoder
A custom JSON encoder.
- runtimepy.net.server.json.encode_json(stream: TextIO, response: ResponseHeader, data: dict[str, Any], response_type: str = 'json') None [source]#
Encode a JSON message response.
- runtimepy.net.server.json.json_handler(stream: TextIO, request: RequestHeader, response: ResponseHeader, request_data: bytes | None, data: dict[str, str | int | float | bool | None | dict[str, str | int | float | bool | None] | list[str | int | float | bool | None]]) None [source]#
Create an HTTP response from some JSON object data.
runtimepy.net.server.markdown module#
A module implementing web server markdown interfaces.
Module contents#
A module implementing a server interface for this package.
- class runtimepy.net.server.RuntimepyServerConnection(transport: Transport, protocol: QueueProtocol, **kwargs)[source]#
Bases:
HttpConnection
A class implementing a server-connection interface for this package.
- classmethod add_redirect_path(dest: str | Path, *src_parts: str | Path) None [source]#
Add a redirect path.
- apps: dict[str, Callable[[Html, RequestHeader, ResponseHeader, bytes | None], Awaitable[Html]]] = {}#
- class_paths: list[Path | str | None] = [PosixPath('.'), PosixPath('/home/vkottler/src/libre-embedded/runtimepy/runtimepy/data')]#
- class_redirect_paths: dict[Path, str | Path] = {}#
- default_app: Callable[[Html, RequestHeader, ResponseHeader, bytes | None], Awaitable[Html]] | None = None#
- favicon_data: bytes#
- async get_handler(response: ResponseHeader, request: RequestHeader, request_data: bytes | None) bytes | None [source]#
Handle GET requests.
- handle_command(stream: TextIO, response: ResponseHeader, args: tuple[str, ...]) None [source]#
Handle a command request.
- json_data: dict[str, str | int | float | bool | None | dict[str, str | int | float | bool | None] | list[str | int | float | bool | None]] = {'test': {'a': 1, 'b': 2, 'c': 3}}#
- paths: list[Path]#
- async post_handler(response: ResponseHeader, request: RequestHeader, request_data: bytes | None) bytes | None [source]#
Handle POST requests.
- redirect_to(path: str, response: ResponseHeader, status: HTTPStatus = HTTPStatus.TEMPORARY_REDIRECT) bytes [source]#
Handle responding with redirection status.
- render_markdown(content: str, response: ResponseHeader, query: str | None, **kwargs) bytes [source]#
Return rendered markdown content.
- async render_markdown_file(path: Path, response: ResponseHeader, query: str | None, **kwargs) bytes [source]#
Render a markdown file as HTML and return the result.
- async try_file(path: Tuple[str, str | None], response: ResponseHeader) bytes | None [source]#
Try serving this path as a file directly from the file-system.
- async try_redirect(path: Tuple[str, str | None], response: ResponseHeader) bytes | None [source]#
Try handling any HTTP redirect rules.