Skip to content

ExtendingAppModules

Ioannis Stais edited this page May 14, 2017 · 1 revision

Extending App Modules

The modules of lightbulb, are the ready-to-use instances of the lightbulb framework and you can use them to perform more complex operations, such as combining multiple CORE modules and multiple HANDLER modules.

In order to extend the core modules, you have to place a file with the request format in folder located at "lightbulb/modules/"

App Modules Format

META = {
    'author': 'Your name goes here',
    'description': 'Short description',
    'type': 'Name with which the module will appear to the user',
        'options': [
            ('OPTION NAME IN CAPITALS', "default value", Boolean value indicating if it is required, 'Short Description for the option'),
       ],
    'comments': ['Comments go here']
}

class Module():

    def setup(self, configuration):
        """
        Sets the variables instances
        Args:
            configuration (dict): A user provided dictionary
            with values defined through lightbulb CLI
        Returns:
            None
        """
        self.sample_option_name = configuration['OPTION NAME IN CAPITALS']

    def getresult(self):
        """
        Returns the bypass string
        Args:
            None
        Returns:
            str: The bypass string
        """

   def learn(self):
        """Initiates learning algorithm"""

   def stats(self):
        """Prints execution statistics"""
        stats = [
            ('Name', 'result'),
         ]

Clone this wiki locally