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.15.tar.gz
(4.0 kB
view details)
Built Distribution
File details
Details for the file mause_rpc-0.0.15.tar.gz
.
File metadata
- Download URL: mause_rpc-0.0.15.tar.gz
- Upload date:
- Size: 4.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.0.5 CPython/3.8.0 Windows/10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fec445bcfa7bd5b637ae1a1ce61d7fcd7be34e67f06d97b795ac565092b6c81d |
|
MD5 | c7abd0bf8199a9cbeabbd88867af5f77 |
|
BLAKE2b-256 | b6093de0853a98f0ffc047032aa0ca5311b480ab71973188d27f4d9e0fa72558 |
File details
Details for the file mause_rpc-0.0.15-py3-none-any.whl
.
File metadata
- Download URL: mause_rpc-0.0.15-py3-none-any.whl
- Upload date:
- Size: 4.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.0.5 CPython/3.8.0 Windows/10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ad49734f3ad6cd0170bfaaa4ad6cd4bd851294852d7e66e2d7b717dbf88bf84f |
|
MD5 | e4072d1a5692aafa54536237a8279ddc |
|
BLAKE2b-256 | 4f393baffbdc29d54eb02bb8ec5c8b158ccf13d70174340dfc56a94800d3793d |