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.18.tar.gz
(4.1 kB
view details)
Built Distribution
File details
Details for the file mause_rpc-0.0.18.tar.gz
.
File metadata
- Download URL: mause_rpc-0.0.18.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 | 0801b218711f75f73b4ab20eff8b54ad0fe07b0d49ff5d919fb2a66f4e4e57a7 |
|
MD5 | 59d9a602a1d475885655b5084ce34050 |
|
BLAKE2b-256 | f6129b96574414021cc5d532c04834db9b93c4e32c52c9772f574d469c506290 |
File details
Details for the file mause_rpc-0.0.18-py3-none-any.whl
.
File metadata
- Download URL: mause_rpc-0.0.18-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 | 147a447ecaaec0b2032a71dc61f1134561adab14c0981de8746f32d9519fd22c |
|
MD5 | 3bd23612b4141a8c1790fcdd17b62b27 |
|
BLAKE2b-256 | bb8875bc9c7f2f555823dddf53c380ac67a422ba4ea112b4cc4c7d498f54320f |