Writing own service plugins¶
The name of your Python module has to start with livebridge_, so it can be discovered at start time. For example livebridge_slack, livebridge_scribblelive or livebridge_liveblog.
The module has also be available in PYTHONPATH to be discovered.
See Tutorial: How to build a Livebridge plugin
plugin components¶
There are four different components, which a custom plugin module can provide:
- Source - implements the way a service is checked for new posts, must be inherited from
livebridge.base.BaseSource
. - Post - implements access to data from a source post, defined by
livebridge.base.BasePost
- Converter - implements a conversion from a specific source to a specific target, has to be inherited from
livebridge.base.BaseConverter
. - Target - implements the create, update and delete (CRUD) actions against a target API, has to be inherited from
livebridge.base.BaseTarget
.
To announce these components to Livebridge, so they can be used and defined in a control file, they have to be available as direct submodule of your plugin module.
For example in an imagined livebridge_acme plugin module the following should be in livebridge_acme/__init__.py:
1 2 3 4 5 6 7 8 | # makes Acme service available as source
from livebridge_acme.source import AcmeSource
# defines access to data from Acme posts
from livebridge_acme.post import AcmePost
# converter from Acme to Foo
from livebridge_acme.converter import AcmeToFooConverter
# make Acme service available as target.
from livebridge_acme.target import AcmeTarget
|
Examples: