A dumb as hell rpc implementation built on rabbitmq
Project description
Mause RPC
A dumb as hell rpc implementation built on rabbitmq
Need to write a server?
from mause_rpc.server import Server
rpc_queue = "rpc.queue"
server = Server(rpc_queue, "rabbitmq://...")
@server.register
def hello(name: str) -> str:
return "hello " + name
@server.register("divide")
def div(a: int, b: int) -> float:
if b == 0:
raise ZeroDivisionError()
return a / b
if __name__ == "__main__":
server.serve()
Need a client?
from mause_rpc.client import get_client
rpc_queue = "rpc.queue"
client = get_client(rpc_queue, "rabbitmq://...")
def test_basic_functionality():
assert client.hello("mark") == "hello mark"
assert client.divide(5, 2) == 2.5
with pytest.raises(ZeroDivisionError):
client.divide(5, 0)
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
mause_rpc-0.0.21.tar.gz
(4.2 kB
view hashes)
Built Distribution
Close
Hashes for mause_rpc-0.0.21-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e9de7073ed16553a06ed72ccc0b92db884548e9b0c8b2b577e70d032966bebb5 |
|
MD5 | f142d3c5390f5ab4ce96e5f2a8b4aa28 |
|
BLAKE2b-256 | 77384592bc863a36255a23abe808c088bb2fb7b56564b3a6d1329bca9d5907b2 |