Registry / devops / jsonrpcserver

jsonrpcserver

JSON →
library5.0.9pypypi✓ verified 84d ago

A library to process JSON-RPC requests in Python, supporting method dispatching, async, and middleware. Current version 5.0.9, maintained on GitHub.

pip install jsonrpcserver
INSTALL
IMPORT
SIG · JSONRPCSERVER
J
jsonrpcserver
devopspythonv5.0.9
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

method
from jsonrpcserver import method
from jsonrpc import method
jsonrpc is a different package; correct import from jsonrpcserver
serve
from jsonrpcserver import serve
from jsonrpcserver import async_serve
In v5, async serve is just serve; no separate async function

Minimal example: define a method and start the server.

from jsonrpcserver import method, serve @method def ping(): return 'pong' if __name__ == '__main__': serve()
Debug
Known issues
breakingIn v5, async serve is now handled by passing `async_=True` to `serve()`, not a separate `async_serve` function. The `async_serve` import was removed.
fix
Use `serve(async_=True)` instead of importing `async_serve`.
affects: >=5.0.0
gotchaThe @method decorator adds methods to a global dispatcher by default. To avoid namespace collisions, pass a custom dispatcher or use the class-based API for multiple services.
fix
Use `dispatcher = Dispatcher(); @dispatcher.add` or create separate dispatchers for different services.
affects: all
deprecatedThe `jsonrpcserver.result` and `jsonrpcserver.exceptions` modules are deprecated in v5. Use the top-level exports or `jsonrpcserver.responses` and `jsonrpcserver.errors`.
fix
Import from `jsonrpcserver` directly, e.g., `from jsonrpcserver import Success, Error`.
affects: >=5.0.0
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'jsonrpcserver'
Package not installed.
fix
Run `pip install jsonrpcserver`.
TypeError: serve() got an unexpected keyword argument 'async_'
Using older version (<5.0.0) where async_=True not supported.
fix
Upgrade to v5: `pip install -U jsonrpcserver`.
NameError: name 'method' is not defined
Forgot to import method from jsonrpcserver.
fix
Add `from jsonrpcserver import method` at the top of the file.
Upgrade
Version history
5.0.9latest on PyPI · released Sep 15, 2022
Audit
Dependencies
aiohttpoptionalFor async server integration (required for async features)
flaskoptionalFor Flask integration (optional, via decorator)
Agent activity
4 hits · last 30 days
node
4
Resources
jsonrpcserver — pip install jsonrpcserver · libregistry