项目作者: porthos-rpc

项目描述 :
A RPC over AMQP library for Python.
高级语言: Python
项目地址: git://github.com/porthos-rpc/porthos-python.git
创建时间: 2017-08-03T03:49:26Z
项目社区:https://github.com/porthos-rpc/porthos-python

开源协议:

下载


Porthos

A RPC over AMQP library for Python.

Goal

Provide a language-agnostic RPC library to write distributed systems.

Client

  1. with porthos.Client("amqp://guest:guest@broker:5672/myVHost", "SampleService") as c:
  2. # call with a dict body
  3. response = c.call("method").with_dict({"foo": "bar"}).sync()
  4. if response.status_code == porthos.Status.OK:
  5. # extract a dict from the response (if response status code is application/json).
  6. print(response.as_dict())
  7. # call with *args body.
  8. response = c.call("method").with_args("foo", "bar").sync()
  9. if response.status_code == porthos.Status.OK:
  10. print(response.content)
  11. # call with a str body.
  12. response = c.call("method").with_body("foo").sync()
  13. if response.status_code == porthos.Status.OK:
  14. print(response.content)

Server

Not implemented yet.

Contributing

Pull requests are very much welcomed. Make sure a test or example is included that covers your change.

Docker is being used for the local environment. To build/run/test your code you can bash into the server container:

  1. $ docker-compose run client bash
  2. root@porthos:/usr/src/app# pytest