flexget.components.notify.notification_framework module#

The notification framework can be used by other plugins to send messages to the user, via a transport service configurable by the user.

Sending Messages#

A plugin who wishes to send messages using this notification framework should import this plugin, then call the send_notification method. Example:

from flexget import plugin

send_notification = plugin.get_plugin_by_name(
    'notification_framework'
).instance.send_notification
send_notification('the title', 'the message', the_notifiers)

Delivering Messages#

To implement a plugin that can deliver messages, it should implement a notify method, which takes (title, message, config) as arguments. The plugin should also have a schema attribute which is a JSON schema that describes the config format for the plugin.

class flexget.components.notify.notification_framework.NotificationFramework[source]#

Bases: object

send_notification(title, message, notifiers, template_renderer=None)[source]#

Send a notification out to the given notifiers with a given title and message.

If template_renderer is specified, title, message, as well as any string options in a notifier’s config will be rendered using this function before sending the message.

Parameters:
  • title (str) – Title of the notification. (some notifiers may ignore this)

  • message (str) – Main body of the notification.

  • notifiers (list) – A list of configured notifier output plugins. The NOTIFY_VIA_SCHEMA JSON schema describes the data structure for this parameter.

  • template_renderer – A function that should be used to render any jinja strings in the configuration.

flexget.components.notify.notification_framework.register_plugin()[source]#
flexget.components.notify.notification_framework.render_config(config, template_renderer, notifier_name, _path='')[source]#

Recurse through config data structures attempting to render any string fields against a given context.

Parameters:
  • config – Any simple data structure as retrieved from the FlexGet config.

  • template_renderer – A function that should take a string or Template argument, and return the result of rendering it with the appropriate context.

  • notifier_name – This is used in log messages to let user know which notifier had a problem when there are rendering errors.