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.19.tar.gz
(4.2 kB
view details)
Built Distribution
File details
Details for the file mause_rpc-0.0.19.tar.gz
.
File metadata
- Download URL: mause_rpc-0.0.19.tar.gz
- Upload date:
- Size: 4.2 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 | 35f8769795fc71f833fd08914381e92b38eaff482a0e9a38f9f5e165d2d6fc15 |
|
MD5 | c7ad526183ad844b58449b0bcadf7fce |
|
BLAKE2b-256 | ebad4ccb3d1be80abe359ecac807a0be12061de8b79cf2e18cea34ac5377ff5f |
File details
Details for the file mause_rpc-0.0.19-py3-none-any.whl
.
File metadata
- Download URL: mause_rpc-0.0.19-py3-none-any.whl
- Upload date:
- Size: 4.7 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 | 75243bd6a21734ee75baa83a83395abab303293eb0661066d401566f91c82fdf |
|
MD5 | e5375196f5bbbc1f17dd5175ba404aaf |
|
BLAKE2b-256 | 023b2b78e09cd939cfdac70af8e430536df14873ecc0c0fcb207c899b14e7317 |