Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

PyPI version CI Python 3.11 to 3.14 Downloads per month License: MIT

jsonrpcclient

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.typed marker. 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.
  • Batches come back as a list, and match_responses pairs each response with its request by id (new in 5.0).
  • A malformed response raises InvalidResponse with a message saying what's wrong, such as missing 'id'. strict=True checks every JSON-RPC 2.0 rule (new in 5.0).
  • Supports Python 3.11 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 4.x?

5.0 is in release candidates: pip install --pre jsonrpcclient gets the latest one, and pip install jsonrpcclient keeps installing 4.x until 5.0.0. Most 4.x code runs unchanged. The migration guide lists every change, and issue 252 tracks the release. Upgrade to 4.2.0 first: it warns about the calls 5.0 handles differently.

Upgrading from 3.x?

Since 4.x the API is completely different: request builds a request and no longer sends it. A 3.x call such as request("http://example.com", "get") raises TypeError in 5.0. On 4.x it runs but sends nothing. Read the migration guide before upgrading.

Documentation

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 5.0.0rc1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for jsonrpcclient 5.0.0rc1
File Size Uploaded Provenance Actions
jsonrpcclient-5.0.0rc1.tar.gz 172.0 kB With provenance Details for jsonrpcclient-5.0.0rc1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for jsonrpcclient 5.0.0rc1
File Interpreter ABI Platform Actions
jsonrpcclient-5.0.0rc1-py3-none-any.whl Python 3 none any Details for jsonrpcclient-5.0.0rc1-py3-none-any.whl

Total release size: 186.7 kB

Release files / jsonrpcclient-5.0.0rc1.tar.gz

Download URL jsonrpcclient-5.0.0rc1.tar.gz
Size 172.0 kB
Tags Source
SHA-256 checksum
How to use checksums
68079108781e4e665d3f027189c0621b86afc15eeb63c38cd251c5b2ebea8d1e
BLAKE2b-256 checksum
How to use checksums
087b8da61d07effc1fd7e8574cc41f58b23d2ae0ac858d8a49344c43e2767d46
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 log

Release files / jsonrpcclient-5.0.0rc1-py3-none-any.whl

Download URL jsonrpcclient-5.0.0rc1-py3-none-any.whl
Size 14.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
929b903a9cae11c73ef800a1b0c0e6f7c483d7073beb5e0339fa4d3c1361a31c
BLAKE2b-256 checksum
How to use checksums
d525012e0ca64e1b1913fb7793b16519d0853ab70b1f858b5ece5b48536aa9f8
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 log

Security for jsonrpcclient 5.0.0rc1

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.

Select from 2 files

Attestation for jsonrpcclient-5.0.0rc1.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 log

A 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.

Release history Release notifications | RSS feed

This release
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page