Skip to main content
Pre-release

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

JSONRPCBase

NOTE: This is a fork of level12/jsonrpcbase with changes maintained by KBase

Simple JSON-RPC service without transport layer

This library is intended as an auxiliary library for easy an implementation of JSON-RPC services with Unix/TCP socket like transport protocols that do not have complex special requirements. You need to utilize some suitable transport protocol with this library to actually provide a working JSON-RPC service.

Features

  • Easy to use, small size, well tested.
  • Supports JSON-RPC v2.0. Compatible with v1.x style calls with the exception of v1.0 class-hinting.
  • Optional argument type validation that significantly eases development of jsonrpc method_data.

Example

Example usage:

import jsonrpcbase

chat_service = jsonrpcbase.JSONRPCService()

def login(username, password, timelimit=0):
    # (...)
    return True

def receive_message(**kwargs):
    # (...)
    return chat_message

def send_message(msg):
    # (...)
    pass

if __name__ == '__main__':

    # Adds the method login to the service as a 'login'.
    chat_service.add(login, types=[basestring, basestring, int])

    # Adds the method receive_message to the service as a 'recv_msg'.
    chat_service.add(receive_message, name='recv_msg', types={"msg": basestring, "id": int})

    # Adds the method send_message as a 'send_msg' to the service.
    chat_service.add(send_message, 'send_msg')

    # Receive a JSON-RPC call.
    jsonmsg = my_socket.recv()

    # Process the JSON-RPC call.
    result = chat_service.call(jsonmsg)

    # Send back results.
    my_socket.send(result)

Development

Install poetry and run poetry install.

Run tests with make test.

Deploy with poetry build and poetry publish.

Credits

This project was originally developed by Juhani Åhman.

Metadata

Release files for kbase-jsonrpcbase 0.3.0a6

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

Source distribution (sdist)

Source distribution for kbase-jsonrpcbase 0.3.0a6
File Size Uploaded Provenance Actions
kbase_jsonrpcbase-0.3.0a6.tar.gz 9.0 kB Without provenance Details for kbase_jsonrpcbase-0.3.0a6.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for kbase-jsonrpcbase 0.3.0a6
File Interpreter ABI Platform Actions
kbase_jsonrpcbase-0.3.0a6-py3-none-any.whl Python 3 none any Details for kbase_jsonrpcbase-0.3.0a6-py3-none-any.whl

Total release size: 18.5 kB

Release files / kbase_jsonrpcbase-0.3.0a6.tar.gz

Download URL kbase_jsonrpcbase-0.3.0a6.tar.gz
Size 9.0 kB
Tags Source
SHA-256 checksum
How to use checksums
ad17753b3ff8bcaf2f686495387a4ff8c7d3bc2f268ce5a83afec48d1d57e690
BLAKE2b-256 checksum
How to use checksums
6b7e9dd4649c07e71728d7a1d47a56ca96580ad38769e053c66624010c6838fd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.0.3 CPython/3.7.3 Linux/5.4.0-42-generic

Release files / kbase_jsonrpcbase-0.3.0a6-py3-none-any.whl

Download URL kbase_jsonrpcbase-0.3.0a6-py3-none-any.whl
Size 9.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
775e1f8dbc157521c528a1b0bfa63cdae733dc3e8dcf743654c175ebb24bb6df
BLAKE2b-256 checksum
How to use checksums
a00160bdad388dea1555d1636b612ef2f4f3034a4389e6addac3b44ca89fd598
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.0.3 CPython/3.7.3 Linux/5.4.0-42-generic

Security for kbase-jsonrpcbase 0.3.0a6

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.

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