tribler.core.restapi.rest_endpoint
Attributes
Classes
The base class for all Tribler REST endpoints. |
|
Create a new root endpoint. |
|
A Tribler response for web requests. |
Functions
|
Create a RESTResponse that tells the use that an exception is handled. |
Module Contents
- tribler.core.restapi.rest_endpoint.HTTP_BAD_REQUEST = 400
- tribler.core.restapi.rest_endpoint.HTTP_UNAUTHORIZED = 401
- tribler.core.restapi.rest_endpoint.HTTP_NOT_FOUND = 404
- tribler.core.restapi.rest_endpoint.HTTP_REQUEST_ENTITY_TOO_LARGE = 413
- tribler.core.restapi.rest_endpoint.HTTP_INTERNAL_SERVER_ERROR = 500
- tribler.core.restapi.rest_endpoint.MAX_REQUEST_SIZE = 16777216
- class tribler.core.restapi.rest_endpoint.RESTEndpoint(middlewares: tuple = (), client_max_size: int = MAX_REQUEST_SIZE)
Bases:
ipv8.taskmanager.TaskManagerThe base class for all Tribler REST endpoints.
- _logger
- app
- class tribler.core.restapi.rest_endpoint.RootEndpoint(middlewares: tuple = (), client_max_size: int = MAX_REQUEST_SIZE)
Bases:
RESTEndpointCreate a new root endpoint.
Essentially, this is the same as any other REST endpoint, but it is supposed to be the top in the hierarchy.
- endpoints: dict[str, RESTEndpoint | ipv8.REST.root_endpoint.RootEndpoint]
- add_endpoint(prefix: str, endpoint: RESTEndpoint | ipv8.REST.root_endpoint.RootEndpoint) None
Add an endpoint to this root endpoint.
- class tribler.core.restapi.rest_endpoint.RESTResponse(body: dict | list | bytes | str | None = None, headers: dict | None = None, content_type: str | None = None, status: int = 200, **kwargs)
Bases:
aiohttp.web.ResponseA Tribler response for web requests.
JSON-compatible response bodies are automatically converted to JSON type.
- tribler.core.restapi.rest_endpoint.return_handled_exception(exception: Exception) RESTResponse
Create a RESTResponse that tells the use that an exception is handled.
- Parameters:
exception – the handled exception
- Returns:
JSON dictionary describing the exception