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.14.tar.gz
(4.0 kB
view details)
Built Distribution
File details
Details for the file mause_rpc-0.0.14.tar.gz
.
File metadata
- Download URL: mause_rpc-0.0.14.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 | dabd175719af91c8517093bc42a2349d9eaa0d2ad2397a27649411792370e1d9 |
|
MD5 | 6ee8a11017f6f1e5b8ab69484860b9d0 |
|
BLAKE2b-256 | 42740f0b490a5f3a60597e3c82d173553e7a3d01e39b1e9555683bbf603bd2d3 |
File details
Details for the file mause_rpc-0.0.14-py3-none-any.whl
.
File metadata
- Download URL: mause_rpc-0.0.14-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 | ebc1fbc5fafa82245c67ab51f5aadc72a4557a91fe25be1ef1dc87da0f328567 |
|
MD5 | 05d5583a2ae5ae45329c73a802442c25 |
|
BLAKE2b-256 | 8db4e7298caae5c432624334af7cab94c0af35957f5bab45ef1ae21fd7971d93 |