tinyrpc

raw JSON →
1.1.7 verified Fri May 01 auth: no python

A small, modular, transport and protocol neutral RPC library supporting JSON-RPC (2.0, 1.0), zmq, and more. Current version 1.1.7. Low release cadence.

pip install tinyrpc
error ImportError: cannot import name 'RPCClient' from 'tinyrpc'
cause Installed version is very old (pre-1.0) or import path used is wrong.
fix
Upgrade to latest: pip install --upgrade tinyrpc. Use correct import: from tinyrpc import RPCClient.
error ModuleNotFoundError: No module named 'tinyrpc.transports.http'
cause HTTP transport is provided by an extra (tinyrpc[http]) not installed by default.
fix
pip install tinyrpc[http] to get the HTTP transport.
error TypeError: __init__() got an unexpected keyword argument 'post'
cause User tried to pass a 'post' argument to HttpPostClientTransport; wrong parameter name.
fix
Use correct constructor: HttpPostClientTransport(endpoint) (no keyword).
gotcha The library is very lightly maintained. Many issues remain open; consider it stable but not actively developed.
fix Test thoroughly before depending on it for critical systems.
gotcha JSON-RPC 2.0 is supported but not all edge cases (e.g., batch requests) are handled correctly.
fix Use other libraries (e.g., jsonrpcclient) if you need robust batch handling.
gotcha The library uses its own exception classes; standard JSON-RPC error object mapping is partial.
fix Catch RPCError from tinyrpc.exc instead of expecting standard error dictionaries.

Quickstart: create a JSON-RPC client via HTTP.

from tinyrpc import RPCClient
from tinyrpc.protocols.jsonrpc import JSONRPCProtocol
from tinyrpc.transports.http import HttpPostClientTransport

client = RPCClient(JSONRPCProtocol(), HttpPostClientTransport('http://localhost:5000/api'))
result = client.call('add', x=1, y=2)
print(result)