python methods

The following methods exist within the <install_location>/share/python-api/codeadvisor/api.py file. Use them in your plug-ins to communicate with Code Advisor:

__init__

Initialize configuration details for a plug-in.

def __init__(self, plugin_name, author, encoding="PROTOBUF")

log

Log a message to Code Advisor's log API

def log(self, log_type, message, *args, **kwargs)

send

Send a message `data` to stream `stream`

def send(self, stream, data)

add_consumer

Subscribe to a stream "plugin:name" with a callback that will be passed the protocol buffer message when it is received

def add_consumer(self, stream, callback)

add_producer

Add a producer that allows messages to be sent.

def add_producer(self, stream_name)

setup

Setup the api, either printing the config string or launching the stdin worker.

def setup(self)

done

Wait until all stdin messages have been received

def done(self)