swh.core.api.asynchronous module¶
-
swh.core.api.asynchronous.
decode_data
(data, content_type, extra_decoders=None)[source]¶ Decode data according to content type, eventually using some extra decoders.
-
async
swh.core.api.asynchronous.
decode_request
(request, extra_decoders=None)[source]¶ Decode asynchronously the request
-
class
swh.core.api.asynchronous.
RPCServerApp
(app_name: Optional[str] = None, backend_class: Optional[Callable] = None, backend_factory: Optional[Union[Callable, str]] = None, middlewares=(), **kwargs)[source]¶ Bases:
MutableMapping
[str
,Any
]For each endpoint of the given backend_class, tells app.route to call a function that decodes the request and sends it to the backend object provided by the factory.
- Parameters
backend_class (Any) – The class of the backend, which will be analyzed to look for API endpoints.
backend_class]] backend_factory (Optional[Callable[[],) – A function with no argument that returns an instance of backend_class. If unset, defaults to calling backend_class constructor directly.
-
client_exception_classes
: Tuple[Type[Exception], …] = ()¶ Exceptions that should be handled as a client error (eg. object not found, invalid argument)
-
extra_type_encoders
: List[Tuple[type, str, Callable]] = []¶ Value of extra_encoders passed to json_dumps or msgpack_dumps to be able to serialize more object types.
-
extra_type_decoders
: Dict[str, Callable] = {}¶ Value of extra_decoders passed to json_loads or msgpack_loads to be able to deserialize more object types.