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
- Python 3.9+
- Pydantic for data models.
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file openrpc-10.3.6.tar.gz
.
File metadata
- Download URL: openrpc-10.3.6.tar.gz
- Upload date:
- Size: 17.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.4 CPython/3.9.17 Linux/5.15.154+
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0ae5f1e8698f2b890c78aa2a681526c58c1192776148f7d8f2b1233296fe5dd1 |
|
MD5 | a701e62d6de7fca0af12ca4de194c6f1 |
|
BLAKE2b-256 | 82ba5bb0fabf595dc1553922458209661fc82de7df196ddb6999ada54c64762e |
File details
Details for the file openrpc-10.3.6-py3-none-any.whl
.
File metadata
- Download URL: openrpc-10.3.6-py3-none-any.whl
- Upload date:
- Size: 21.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.4 CPython/3.9.17 Linux/5.15.154+
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3aa68e7778268b53641e311368cde60b1bf66d1d74073798c606c620ee664311 |
|
MD5 | 4db10dae05befbf94707bacc60265be2 |
|
BLAKE2b-256 | 2315127d5e438e4e4ca26d828081e3e7bc09ab432b40925090c6acd6a9bfff6a |