Skip to main content

Django jsonrpc implementation

Install

pip install django-jsonrpc-framework

Advantages

  • Complete support for JSON-RPC 2.0 (Request, Notification, Batch)
  • Auto-generation of openrpc.json (OpenRPC 1.3.2)
  • Auto-generation of OpenRPC documentation (like Swagger)
  • Async support

Create methods

We provide several ways to create methods.

  • Using method_ prefix
  • Using jsonrpc_method decorator
  • Rename an existing function to a new name
from jsonrpc_framework import BaseController
from jsonrpc_framework.controller.decor import jsonrpc_method


class EchoController(BaseController):
    def method_echo_hello(self, name: str) -> str:
        return f"hello {name}"

    @jsonrpc_method
    def echo_goodbye(self, name: str) -> str:
        return f"goodbye {name}"

    @jsonrpc_method("echo_see_you")
    def wrong_name(self, name) -> str:
        return "See you from echo_see_you method"

Adding several controllers to one controller

from jsonrpc_framework import RouteController


class PrintController(BaseController):
    async def method_print_hello(self, name) -> None:
        print(f"hello {name}")

    @jsonrpc_method
    async def print_goodbye(self, name) -> None:
        print(f"goodbye {name}")


route = RouteController(
    "jsonrpc",
    controllers=[
        PrintController,
        EchoController,
    ],
)

Generating openrpc.json and OpenRPC documentation

from jsonrpc_framework.controller.openrpc.collectors import OpenRpcCollector

collector = OpenRpcCollector(
    PrintController, EchoController, title="My mini API"
)


urlpatterns = [
    path("echorpc", EchoController, as_view),
    path("jsonrpc", route.as_view()),
    path("openrpc.json", OpenRpcJsonView.as_view(collector=collector)),
    path("docs", OpenRpcDocView.as_view()),
]

OpenRPC.json example

OpenRPC docs

OpenRPC doc example

OpenRPC docs

Metadata

Release files for django-jsonrpc-framework 0.2.1

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

Source distribution (sdist)

Source distribution for django-jsonrpc-framework 0.2.1
File Size Uploaded Provenance Actions
django_jsonrpc_framework-0.2.1.tar.gz 25.0 kB Without provenance Details for django_jsonrpc_framework-0.2.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for django-jsonrpc-framework 0.2.1
File Interpreter ABI Platform Actions
django_jsonrpc_framework-0.2.1-py3-none-any.whl Python 3 none any Details for django_jsonrpc_framework-0.2.1-py3-none-any.whl

Total release size: 75.2 kB

Release files / django_jsonrpc_framework-0.2.1.tar.gz

Download URL django_jsonrpc_framework-0.2.1.tar.gz
Size 25.0 kB
Tags Source
SHA-256 checksum
How to use checksums
ae3db2ce64af27cb8e1cef617b017acee241e157a378de0ca82516e0778bbb80
BLAKE2b-256 checksum
How to use checksums
5bda44bc6fdf795dc3b79fd2e45eec1486861144e450ed5dbb32222dd9cb6fc5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / django_jsonrpc_framework-0.2.1-py3-none-any.whl

Download URL django_jsonrpc_framework-0.2.1-py3-none-any.whl
Size 50.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e39662c44584c6a2e440feb8eb81bc4e64c0122d2b1e59cfea7c133c45973510
BLAKE2b-256 checksum
How to use checksums
76855d3f469892dec55146de5074ec7d90a3084c5ebe54ca7d12872a80e44045
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for django-jsonrpc-framework 0.2.1

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