Skip to main content

Transport agnostic framework for developing OpenRPC servers.

Project description

Python OpenRPC

Documentation: https://python-openrpc.burkard.cloud

Source Code: https://gitlab.com/mburkard/openrpc

Python OpenRPC is a transport agnostic framework for quickly and easily developing OpenRPC servers in Python.

Requirements

Installation

OpenRPC is on PyPI and can be installed with:

pip install openrpc

Or with Poetry

poetry add openrpc

Example

This is a minimal OpenRPC server hosted over HTTP and WebSockets using Tabella and uvicorn.

from openrpc import RPCServer
import tabella

rpc = RPCServer(title="DemoServer", version="1.0.0")


@rpc.method()
async def add(a: int, b: int) -> int:
    return a + b


app = tabella.get_app(rpc)

if __name__ == "__main__":
    uvicorn.run(app, host="0.0.0.0", port=8080)

Example In

{
  "id": 1,
  "method": "add",
  "params": {
    "a": 1,
    "b": 3
  },
  "jsonrpc": "2.0"
}

Example Result Out

{
  "id": 1,
  "result": 4,
  "jsonrpc": "2.0"
}

Template App

A template app is available as an example or to clone to bootstrap your RPC server.

Support the Developer

Buy Me a Coffee

Project details


Download files

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

Source Distribution

openrpc-10.4.0.tar.gz (17.9 kB view details)

Uploaded Source

Built Distribution

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

openrpc-10.4.0-py3-none-any.whl (21.9 kB view details)

Uploaded Python 3

File details

Details for the file openrpc-10.4.0.tar.gz.

File metadata

  • Download URL: openrpc-10.4.0.tar.gz
  • Upload date:
  • Size: 17.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.9.17 Linux/5.15.154+

File hashes

Hashes for openrpc-10.4.0.tar.gz
Algorithm Hash digest
SHA256 b8c03663747bfecea2a04f550e92cb505875073587700c371ed5926572e74c67
MD5 3f6398845a0837f2dd627f721180425f
BLAKE2b-256 64f566dfc792f90fd6934d82d43cac207eb6e7ddd0e012171a93282f687019b6

See more details on using hashes here.

File details

Details for the file openrpc-10.4.0-py3-none-any.whl.

File metadata

  • Download URL: openrpc-10.4.0-py3-none-any.whl
  • Upload date:
  • Size: 21.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.9.17 Linux/5.15.154+

File hashes

Hashes for openrpc-10.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ccdbf279ac54ee077c531b51fa6566d5fb24cbd71d7896c878e8c53f915e1f3c
MD5 8caed2da9bbab8511db1a87fd00d22d2
BLAKE2b-256 208860519409ef899333207006ff7ec7ef8f3d1bc652091aa50132bbe88dfb36

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page