https://github.com/mause/rpc
Very simple python rabbitmq/pika rpc library
https://github.com/mause/rpc
pika python rpc
Last synced: 5 months ago
JSON representation
Very simple python rabbitmq/pika rpc library
- Host: GitHub
- URL: https://github.com/mause/rpc
- Owner: Mause
- License: mit
- Created: 2020-04-25T05:53:47.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2025-04-16T00:49:44.000Z (6 months ago)
- Last Synced: 2025-05-05T21:16:26.242Z (5 months ago)
- Topics: pika, python, rpc
- Language: Python
- Homepage:
- Size: 470 KB
- Stars: 5
- Watchers: 2
- Forks: 0
- Open Issues: 22
-
Metadata Files:
- Readme: README.md
- Changelog: History.md
- License: LICENSE
Awesome Lists containing this project
README
Mause RPC
=========A dumb as hell rpc implementation built on rabbitmq
Need to write a server?
```py
from mause_rpc.server import Serverrpc_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 / bif __name__ == "__main__":
server.serve()
```Need a client?
```py
from mause_rpc.client import get_clientrpc_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.5with pytest.raises(ZeroDivisionError):
client.divide(5, 0)
```