Skip to main content

Gevent powered cross service communication tool

Project description

This tool is aimed to provide simple and customizable interface for communication between different services over sockets. No encryption yet.

Simple example:

Client:

from crosservice.signals import BaseSignal

class PingSignal(BaseSignal):
    _host = '127.0.0.1'
    _port = 5555
    signal = 'ping'
    expect_data = ['time']

if __name__ == '__main__':
    ping = PingSignal({'foo': 'bar'})
    if ping.result:
        print ping.result.foo, ':', ping.result.time
    else:
        print "Error: ", ping.result.error

Server:

from crosservice.server import start_server
from crosservice.handlers import BaseHandler
import time

class PingHandler(BaseHandler):
    signal = 'ping'
    required_data = ['foo']

    def run(self, foo):
        if foo == 'bar':
            foo = 'received at'
            self.result.foo = foo
            self.result.time = time.time()
        else:
            self.result.error = 'Bad foo!'

if __name__ == '__main__':
    start_server('127.0.0.1', 5555, 1000)

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

crosservice-0.2.15.tar.gz (18.8 kB view details)

Uploaded Source

File details

Details for the file crosservice-0.2.15.tar.gz.

File metadata

File hashes

Hashes for crosservice-0.2.15.tar.gz
Algorithm Hash digest
SHA256 bc5f8236fd2f1c4705b6c5e7ebfdb1cc16c8e5987e53c8fbc4289e005192e1ef
MD5 adabb6ad23b571a28b6456cba9427dfc
BLAKE2b-256 e9b63e652c92a0642d5d32966dc51146a087709b5fefca87dcc015a3636793f6

See more details on using hashes here.

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