pseud
Pythonic bidirectional-rpc API built on top of ØMQ with pluggable encryption, authentication and heartbeating support.
Features
ØMQ transport layer.
All native python types supported (msgpack).
First citizen exceptions.
Bi-bidirectional (server can initiate calls to connected clients).
Encryption based on CURVE.
Pluggable Authentication.
Pluggable Heartbeating.
Pluggable Remote Call Routing.
Built-in proxy support. A server can delegate the work to another one.
SyncClient (using zmq.REQ) to use within non event based processes. (Heartbeating, Authentication and job execution are not supported with the SyncClient.)
Installation
$ pip install pseud
Execution
The Server
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)
await server.start() # this will block forever
The Client
from pseud import Client
client = Client('service', io_loop=loop)
client.connect('tcp://127.0.0.1:5555')
# Assume we are inside a coroutine
async with client:
response = await client.hello('Charly')
assert response == 'Hello Charly'
The SyncClient
# to use within a non-asynchronous process or in a command interpreter
from pseud import SyncClient
client = SyncClient()
client.connect('tcp://127.0.0.1:5555')
assert client.hello('Charly') == 'Hello Charly'
The Server send a command to the client
It is important to note that the server needs to know which peers are connected to it. This is why the security_plugin trusted_peer comes handy. It will register all peer id and be able to route messages to each of them.
from pseud import Server
server = Server('service', security_plugin='trusted_peer')
server.bind('tcp://127.0.0.1:5555')
@server.register_rpc
def hello(name):
return 'Hello {0}'.format(name)
await server.start() # this will block forever
The client needs to send its identity to the server. This is why plain security plugin is used. The server will not check the password, he will just take into consideration the user_id to perform the routing.
from pseud import Client
client = Client('service',
security_plugin='plain',
user_id='alice',
password='')
client.connect('tcp://127.0.0.1:5555')
# Action that the client will perform when
# requested by the server.
@client.register_rpc(name='draw.me.a.sheep')
def sheep():
return 'beeeh'
Back on server side, we can send to it any commands the client is able to do.
# assume we are inside a coroutine
sheep = await server.send_to('alice').draw.me.a.sheep()
assert sheep == 'beeeh'
Documentation
Copyright 2014 ezeep GmbH
Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Metadata
Release files for pseud 1.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pseud-1.0.1.tar.gz | 12.7 kB | Without provenance | Details for pseud-1.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pseud-1.0.1-py3-none-any.whl | Python 3 | none | any | Details for pseud-1.0.1-py3-none-any.whl |
Total release size: 28.7 kB
Release files / pseud-1.0.1.tar.gz
| Download URL | pseud-1.0.1.tar.gz |
|---|---|
| Size | 12.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
417c88e3f51797d8eef186f433c4ea31cdf21cc8da1a0f3ca52577a1d521b54a
|
|
BLAKE2b-256 checksum How to use checksums |
2e34e58cf0dad0ee253a70808d9c68b25a4730a1f2e5f58a8cec1c0e76ef6dad
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / pseud-1.0.1-py3-none-any.whl
| Download URL | pseud-1.0.1-py3-none-any.whl |
|---|---|
| Size | 16.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
cd24f8be43ab13d628b108ac6c141bdf6031bdcfa09bd7c2ba35f80cd03c5e67
|
|
BLAKE2b-256 checksum How to use checksums |
86b4cf1c5d9bb40920343967b8948f9952e9c765e78cb5166db8ea61ff217c5e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for pseud 1.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.