Skip to main content

Django jsonrpc implementation

install

pip install django-jsonrpc-framework

Advantages

  • Complete support jsonrpc 2.0 (Request, Notificatin, Batch)
  • Auto generation openrpc.json 1.3.2 version
  • Auto generation OpenRPC documentation (like swagger)
  • Async support

Create methods

We provide several methods creating methods.

  • Using method_ prefix
  • Using jsonrpc_method decorator
  • Rename existing func to 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 fron 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,
    ],
)

Generation 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

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django_jsonrpc_framework-0.2.0.tar.gz (23.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

django_jsonrpc_framework-0.2.0-py3-none-any.whl (47.0 kB view details)

Uploaded Python 3

File details

Details for the file django_jsonrpc_framework-0.2.0.tar.gz.

File metadata

  • Download URL: django_jsonrpc_framework-0.2.0.tar.gz
  • Upload date:
  • Size: 23.1 kB
  • Tags: Source
  • Uploaded using 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}

File hashes

Hashes for django_jsonrpc_framework-0.2.0.tar.gz
Algorithm Hash digest
SHA256 9d714d085860211986adb8490d76da08562655ac72c9a4b05a3f675cb4b91b52
MD5 fee2267a1016f2258e213f06d333c3fd
BLAKE2b-256 d5727670a8c879df1bdb1135b63e4da80bfb286cf0f7f98cd0b7d4751b0282d2

See more details on using hashes here.

File details

Details for the file django_jsonrpc_framework-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: django_jsonrpc_framework-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 47.0 kB
  • Tags: Python 3
  • Uploaded using 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}

File hashes

Hashes for django_jsonrpc_framework-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 54eaf6018f81703bd437d0f0f32e0204d5bbd85ef203b4faf66d353862016a75
MD5 19baa58da3787e6890b0d3623e1212f3
BLAKE2b-256 23d93c52dc5f586a3035600fffcd34d83284d677de133f5abfa430087c49b3ce

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 files

0.1.0

2 files

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