tcpy

Kitten-simple TCP Frameworks.


Keywords
TCP, server, client, framework
License
Other
Install
pip install tcpy==0.0.10

Documentation

Python Yogurt

tcpy is a lightweight framework for building asynchronous TCP services and clients. Designed for sleepy kitten simplicity.

Full documentation: tcpy.readthedocs.org.

Hello, World

Associate a command to a TCPHandler, define its execute() method and tcpy has you up and running.

# Server
from tcpy import TCPServer, TCPHandler

class HelloWorldHandler(TCPHandler):
    def execute(self):
        return self.success(message="Hello, world!")

server = TCPServer()
server.commands = {
    'hello_world': HelloWorldHandler
}

if __name__ == "__main__":
    server.listen()

On the client side, just execute() one of the server's commands.

# Client
from tcpy import TCPClient

print TCPClient().execute(cmd="hello_world")

Which outputs: {'message': 'Hello world!', 'success': True}.

Installation

tcpy is hosted on PyPI. Easiest installation is with pip:

pip install tcpy

Alternatively, you can download a tarball of the source here.

Documentation

Full documentation is hosted at tcpy.readthedocs.org.