API Documentation

This section provides the API documentation for BTHLabs JSONRPC - aiohttp.

Views

class bthlabs_jsonrpc_aiohttp.JSONRPCView(namespace: Optional[str] = None)

The JSONRPC View. This is the main JSONRPC entry point. Use it to register your JSONRPC endpoints.

Example:

from bthlabs_jsonrpc_aiohttp import JSONRPCView

app.add_routes([
    web.post('/rpc', JSONRPCView()),
    web.post('/example/rpc', JSONRPCView(namespace='examnple')),
])
async __call__(request: aiohttp.web_request.Request) aiohttp.web_response.Response

The request handler.

async can_call(request: aiohttp.web_request.Request, method: str, args: list, kwargs: dict) bool

Hook for subclasses to perform additional per-call permissions checks etc. The default implementation returns True.