3.0.ipv8.REST.base_endpoint =========================== .. py:module:: 3.0.ipv8.REST.base_endpoint Attributes ---------- .. autoapisummary:: 3.0.ipv8.REST.base_endpoint.HTTP_BAD_REQUEST 3.0.ipv8.REST.base_endpoint.HTTP_UNAUTHORIZED 3.0.ipv8.REST.base_endpoint.HTTP_NOT_FOUND 3.0.ipv8.REST.base_endpoint.HTTP_CONFLICT 3.0.ipv8.REST.base_endpoint.HTTP_PRECONDITION_FAILED 3.0.ipv8.REST.base_endpoint.HTTP_INTERNAL_SERVER_ERROR 3.0.ipv8.REST.base_endpoint.DEFAULT_HEADERS 3.0.ipv8.REST.base_endpoint.T 3.0.ipv8.REST.base_endpoint.MiddleWaresType Classes ------- .. autoapisummary:: 3.0.ipv8.REST.base_endpoint.BaseEndpoint 3.0.ipv8.REST.base_endpoint.Response Module Contents --------------- .. py:data:: HTTP_BAD_REQUEST :value: 400 .. py:data:: HTTP_UNAUTHORIZED :value: 401 .. py:data:: HTTP_NOT_FOUND :value: 404 .. py:data:: HTTP_CONFLICT :value: 409 .. py:data:: HTTP_PRECONDITION_FAILED :value: 412 .. py:data:: HTTP_INTERNAL_SERVER_ERROR :value: 500 .. py:data:: DEFAULT_HEADERS :type: dict[str, str] .. py:data:: T .. py:data:: MiddleWaresType .. py:class:: BaseEndpoint(middlewares: MiddleWaresType = ()) Bases: :py:obj:`Generic`\ [\ :py:obj:`T`\ ] Base class for all REST endpoints. .. py:attribute:: _logger .. py:attribute:: app .. py:attribute:: session :type: T | None :value: None .. py:attribute:: endpoints :type: dict[str, BaseEndpoint] .. py:method:: setup_routes() -> None Register the names to make this endpoint callable. .. py:method:: initialize(session: T) -> None Initialize this endpoint for the given session instance. .. py:method:: add_endpoint(prefix: str, endpoint: BaseEndpoint) -> None Add a new child endpoint to this endpoint. .. py:class:: Response(body: Any = None, headers: aiohttp.typedefs.LooseHeaders | None = None, content_type: str | None = None, status: int = 200, **kwargs) Bases: :py:obj:`aiohttp.web.Response` A convenience class to auto-encode response bodies in JSON format.