jsonrpc-requests: a compact JSON-RPC client library backed by requests
This is a compact and simple JSON-RPC client implementation written while debugging a picky server.
Main Features
Python 2.7, 3.4, 3.5, 3.6 compatible
Exposes requests options
Supports nested namespaces (eg. app.users.getUsers())
100% test coverage
TODO
Batch requests (http://www.jsonrpc.org/specification#batch)
Usage
from jsonrpc_requests import Server
server = Server('http://localhost:8080')
server.foo(1, 2)
server.foo(bar=1, baz=2)
server.foo({'foo': 'bar'})
server.foo.bar(baz=1, qux=2)
A notification:
from jsonrpc_requests import Server
server.foo(bar=1, _notification=True)
Pass through arguments to requests (see also requests documentation)
from jsonrpc_requests import Server
server = Server('http://localhost:8080', auth=('user', 'pass'), headers={'x-test2': 'true'})
Pass through requests exceptions
from jsonrpc_requests import Server, TransportError
server = Server('http://unknown-host')
try:
server.foo()
except TransportError as transport_error:
print(transport_error.cause) # this will hold a `requests.exceptions.RequestException` instance
Tests
Install the Python tox package and run tox, it’ll test this package with various versions of Python.
Credits
@mbroadst for providing full support for nested method calls, JSON-RPC RFC compliance and other improvements.
@vaab for providing api and tests improvements, better RFC compliance.
Metadata
Release files for jsonrpc-requests 0.4.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 |
|---|---|---|---|---|
| jsonrpc-requests-0.4.0.zip | 8.9 kB | Without provenance | Details for jsonrpc-requests-0.4.0.zip |
Release files / jsonrpc-requests-0.4.0.zip
| Download URL | jsonrpc-requests-0.4.0.zip |
|---|---|
| Size | 8.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
96d955e00397bb67a11c8ff3aa73df4c56bbc2c1fb1a3c60a081a6c591e5cd6e
|
|
BLAKE2b-256 checksum How to use checksums |
caecda48ac30344bbb53e92f6e5e4e97df919bab351db146d249c471a124f390
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for jsonrpc-requests 0.4.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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
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.