Skip to main content

Bi-directional RPC API on top of pyzmq

Project description

https://travis-ci.org/ezeep/pseud.png?branch=master https://coveralls.io/repos/ezeep/pseud/badge.png Latest PyPI version Code Health

Pythonic bidirectional-rpc API built on top of ØMQ with pluggable encryption, authentication and heartbeating support.

Features

  1. ØMQ transport layer.

  2. All native python types supported (msgpack).

  3. First citizen exceptions.

  4. Bi-bidirectional (server can initiate calls to connected clients).

  5. Encryption based on CURVE.

  6. Pluggable Authentication.

  7. Pluggable Heartbeating.

  8. Pluggable Remote Call Routing.

  9. Works with tornado ioloop or gevent.

  10. Built-in proxy support. A server can delegate the work to another one.

  11. SyncClient (using zmq.REQ) to use within non event based processes. (Heartbeating, Authentication and job execution are not supported with the SyncClient.)

Installation

Tornado

pip install -e .[Tornado]

Gevent

pip install -e .[Gevent]

Execution

If both backends are installed, tornado is used by default. To force gevent over tornado, set the environment variable $NO_TORNADO to something.

NO_TORNADO=1 python script.py

Preview

# The server
# Assume tornado IOLoop is running
from pseud import Server


server = Server('service')
server.bind('tcp://127.0.0.1:5555')

@server.register_rpc
def hello(name):
    return 'Hello {0}'.format(name)

server.start()
# The tornado client
# Assume tornado IOLoop is running
from pseud import Client


client = Client('service')
client.connect('tcp://127.0.0.1:5555')

# Assume we are inside a coroutine
response = yield client.hello('Charly')
assert response == 'Hello Charly'
# The gevent client
from pseud import Client


client = Client('service')
client.connect('tcp://127.0.0.1:5555')

assert client.hello('Charly').get() == 'Hello Charly'

Documentation

Pseud on Readthedocs

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pseud-0.0.4.tar.gz (13.0 kB view hashes)

Uploaded Source

Built Distribution

pseud-0.0.4-py27-none-any.whl (17.6 kB view hashes)

Uploaded Python 2.7

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page