mirror of
https://github.com/gsi-upm/senpy
synced 2024-12-22 13:08:13 +00:00
Example plugin and README file
This commit is contained in:
parent
6561201cc2
commit
ed22679e7c
19
README.md
Normal file
19
README.md
Normal file
@ -0,0 +1,19 @@
|
||||
# Senpy Plugins
|
||||
|
||||
# Installing
|
||||
|
||||
|
||||
First, install senpy from source or through pip:
|
||||
|
||||
pip install senpy
|
||||
|
||||
Each plugin has different requirements.
|
||||
As of this writing, requirement installation is done manually for each plugin.
|
||||
All requirements are specified in the .senpy file and, alternatively, in a requirements.txt file.
|
||||
|
||||
# Running
|
||||
|
||||
Run with:
|
||||
|
||||
git clone https://github.com/gsi-upm/senpy-plugins-community.git
|
||||
senpy -f senpy-plugins-community
|
17
example-plugin/example.py
Normal file
17
example-plugin/example.py
Normal file
@ -0,0 +1,17 @@
|
||||
from senpy.plugins import SentimentPlugin
|
||||
from senpy.models import Response
|
||||
|
||||
import logging
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
class ExamplePlugin(SentimentPlugin):
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(ExamplePlugin, self).__init__(*args, **kwargs)
|
||||
logger.warn('%s: the answer to life, the universe and everything'
|
||||
% self._info.get('custom_attribute'))
|
||||
|
||||
def analyse(self, *args, **kwargs):
|
||||
logger.warn('Analysing with the example')
|
||||
return Response()
|
16
example-plugin/example.senpy
Normal file
16
example-plugin/example.senpy
Normal file
@ -0,0 +1,16 @@
|
||||
{
|
||||
"name": "ExamplePlugin",
|
||||
"module": "example",
|
||||
"description": "I am just an example",
|
||||
"author": "@balkian",
|
||||
"version": "0.1",
|
||||
"extra_params": {
|
||||
"timeout": {
|
||||
"@id": "timeout_sleep",
|
||||
"aliases": ["timeout", "to"],
|
||||
"required": false,
|
||||
"default": 0
|
||||
}
|
||||
},
|
||||
"custom_attribute": "42"
|
||||
}
|
Loading…
Reference in New Issue
Block a user