Skip to main content

KQML messaging classes in Python.

Project description

PyKQML

PyKQML is an implementation of KQML messaging in Python.

Installation

PyKQML can be installed as

pip install pykqml

Note that releases of PyKQML up to 0.5 work in Python 2 only, whereas releases after 0.5 work in Python 3 only.

To install for Python 2, use:

pip install pykqml==0.5

To install for Python 3 (or force an upgrade to a compatible version), use

pip install "pykqml>0.5"

Usage

PyKQML implements the following KQML classes, which allow constructing and manipulating KQML messages programmatically:

KQMLToken
KQMLString
KQMLQuotation
KQMLList
KQMLPerformative
KQMLReader
KQMLDispatcher
KQMLModule

You can import KQML classes as, for instance,

from kqml import KQMLList

You can create a new KQML messaging agent as

from kqml import KQMLModule

class MyAgent(KQMLModule):
    def __init__(self, argv):
        # Initialize the agent
        super(MyAgent, self).__init__(argv)
        self.ready()
        super(MyAgent, self).start()

    def receive_request(self, msg, content):
        # Handle request and construct a reply_msg
        # ...
        self.reply(msg, reply_msg)

Testing

You can run all tests by running nosetests in the top level folder.

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

pykqml-1.0.tar.gz (10.1 kB view hashes)

Uploaded Source

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