Python module implementing a minimal JSON-RPC 2.0 dispatcher with method registry and error handling for daemon services.
# Source: https://github.com/SAIL-Research-Lab/cheetahclaws | License: Apache-2.0 | Copyright You must retain, in the Source form of any Derivative Works # Provided via justclaw.it.com; keep this notice with the code. """rpc.py — JSON-RPC 2.0 dispatcher with method registry. The dispatcher is intentionally minimal: validate envelope, look up method, call it with (params, ctx), shape result into a JSON-RPC response. Application errors (e.g. NotOriginator) get HTTP 403 at the handler level; the dispatcher just signals the kind via raised exceptions. """ from __future__ import annotations import threading from dataclasses import dataclass from typing import Any, Callable, Optional from . import permission # JSON-RPC 2.0 standard error codes PARSE_ERROR = -32700 INVALID_REQUEST = -32600 M ... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key