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.20.tar.gz
(4.4 kB
view details)
Built Distribution
File details
Details for the file mause_rpc-0.0.20.tar.gz
.
File metadata
- Download URL: mause_rpc-0.0.20.tar.gz
- Upload date:
- Size: 4.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.6 CPython/3.9.5 Windows/10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 468138b41652cd96f842a1784cd5f43bfe2cb1d70a8b8d99fd1756afad3c5c27 |
|
MD5 | d4983070c012b08d23b0e45ac168d172 |
|
BLAKE2b-256 | 98f1161a875b8056790555f70b788d8bfdf45bd09fa37d3c443bbc877fa5b7f5 |
File details
Details for the file mause_rpc-0.0.20-py3-none-any.whl
.
File metadata
- Download URL: mause_rpc-0.0.20-py3-none-any.whl
- Upload date:
- Size: 4.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.6 CPython/3.9.5 Windows/10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 60e8d8fb2326a2454ec97e58b609780b192554c83a0687f12decf5bd766a1467 |
|
MD5 | 462885e17d1cf34194b9920828cd0768 |
|
BLAKE2b-256 | 77598297db98bb3e1961490360ea02a02ffda4c5927c585533006e57cde53dba |