Create JSON-RPC 2.0 requests and parse responses in Python
Documentation | API reference | Examples | Changelog | Migration
jsonrpcclient builds JSON-RPC 2.0 requests and parses the responses. It doesn't send anything, so it works with any transport: HTTP, websockets, ZeroMQ, or something of your own.
Features
- Builds requests for any transport. You send them with the library you already use.
- No dependencies outside the standard library.
- Typed, with a
py.typedmarker. The package passes mypy and pyright in strict mode. - Requests, notifications and batches, with ids that count up or are hex, random or UUID strings.
- Id generators are safe to share between threads, and CI runs the tests on free-threaded Python 3.14t.
- A malformed response raises
InvalidResponsewith a message saying what's wrong, such asmissing 'id'(new in 4.1.0). - Supports Python 3.8 to 3.14.
Install
pip install jsonrpcclient
The changelog lists what changed in each release.
Quickstart
This sends ping to a JSON-RPC server at http://localhost:8000/, using
requests for the HTTP part:
import requests
from jsonrpcclient import Error, Ok, parse, request
url = "http://localhost:8000/"
response = requests.post(url, json=request("ping"), timeout=10)
response.raise_for_status()
parsed = parse(response.json())
if isinstance(parsed, Ok):
print(parsed.result)
elif isinstance(parsed, Error):
print("Error:", parsed.message)
Output:
pong
For JSON strings, use request_json and parse_json. The
examples show the same
thing with urllib, httpx, aiohttp, websockets and ZeroMQ.
Upgrading from 3.x?
The 4.x API is completely different: request builds a request and no longer
sends it. A 3.x call such as request("http://example.com", "get") still runs
but sends nothing, so read the
migration guide
before upgrading.
Documentation
- User guide: requests, notifications, batches, ids, responses and error handling
- API reference
- Transport examples
- FAQ
- Contributing and security policy
- License: MIT
See also
jsonrpcserver processes incoming JSON-RPC requests in Python. It's the server-side companion to this library.
Credits
Created by Beau Barker. Maintained by Synapse Research.
Metadata
Release files for jsonrpcclient 4.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| jsonrpcclient-4.1.0.tar.gz | 161.0 kB | With provenance | Details for jsonrpcclient-4.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| jsonrpcclient-4.1.0-py3-none-any.whl | Python 3 | none | any | Details for jsonrpcclient-4.1.0-py3-none-any.whl |
Total release size: 172.8 kB
Release files / jsonrpcclient-4.1.0.tar.gz
| Download URL | jsonrpcclient-4.1.0.tar.gz |
|---|---|
| Size | 161.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
353cb7431610c545a451a6da285c2c21c0e4a8040333543da26c7c07bbb3fa80
|
|
BLAKE2b-256 checksum How to use checksums |
5f2d5af073ca2032bbf221ae5a140f0de0cb0f92724a34bcc8e3baa87fe14762
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 6, 2026.
Transparency logRelease files / jsonrpcclient-4.1.0-py3-none-any.whl
| Download URL | jsonrpcclient-4.1.0-py3-none-any.whl |
|---|---|
| Size | 11.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ef718f50ad825d128e9839a556d4b1801d727727ddcdb66382d91c89f7431973
|
|
BLAKE2b-256 checksum How to use checksums |
553db8816cccae24f2711ca45bfd2f654c9e8ac04a726c6f0752cb7faafffc05
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 6, 2026.
Transparency logSecurity for jsonrpcclient 4.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for jsonrpcclient-4.1.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 6, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.