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.17.tar.gz
(4.1 kB
view details)
Built Distribution
File details
Details for the file mause_rpc-0.0.17.tar.gz
.
File metadata
- Download URL: mause_rpc-0.0.17.tar.gz
- Upload date:
- Size: 4.1 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 | 80759e7a4d18faed54c6f31e949cf9f98f33efad08a2f4cadd51165983692fc8 |
|
MD5 | 86bec7605069fc056f87ab35085e1a82 |
|
BLAKE2b-256 | 8b298549d981aed7c5c9305bf655e4610ac37f33c95d8734be0cf37580ef8f1c |
File details
Details for the file mause_rpc-0.0.17-py3-none-any.whl
.
File metadata
- Download URL: mause_rpc-0.0.17-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 | 567801e4f26af98bef942d5aa5deab8ab07bb3c5bdb48754a265e601fca3ed7f |
|
MD5 | 3df4036b076acf9644d7f59fd2c7c740 |
|
BLAKE2b-256 | d10bd4449d1f12c0aa3738757999cbc7a064aad0b0b525b4945c5036c9a4775c |