webapp

Code.webapp.get_locale()[source]

Get the locale from the config.

Get the locale specified in the config. This does not need to be called as it is done so automatically by babel.

Returns:
str

The locale.

See also

pyra.locales.get_locale
Use this function instead.

Examples

>>> get_locale()
en
Code.webapp.home()[source]

Serve the webapp home page.

This page is where most of the functionality for Plugger is provided.

Returns:
render_template

The rendered page.

Notes

The following routes trigger this function.

  • /
  • /home

Examples

>>> home()
Code.webapp.image(img)[source]

Get image from static/images directory.

Returns:
flask.send_from_directory

The image.

Notes

The following routes trigger this function.

  • /favicon.ico

Examples

>>> image('favicon.ico')
Code.webapp.install_plugin()[source]

Install a plugin.

Todo

Complete this function.

Code.webapp.installed_plugins()[source]

Serve the list of installed plugins.

Code.webapp.log_stream(plugin_identifier)[source]

Serve the plugin logs in plain text.

Collect and format the logs for the specified plugin.

Parameters:
plugin_identifier : str

The reverse domain name of the plugin, e.g. dev.lizardbyte.plugger.

Returns:
Response

The text of the log files.

Notes

The following routes trigger this function.

  • /log_stream/
  • /log_stream/<plugin name>

Examples

>>> log_stream(plugin_identifier='dev.lizardbyte.plugger')
Code.webapp.logs(plugin_identifier)[source]

Serve the plugin logs.

Collect and format the logs for the specified plugin.

Parameters:
plugin_identifier : str

The reverse domain name of the plugin, e.g. dev.lizardbyte.plugger.

Returns:
render_template

The logs template with the requested information.

Notes

The following routes trigger this function.

  • /logs/
  • /logs/<plugin name>

Examples

>>> logs(plugin_identifier='dev.lizardbyte.plugger')
Code.webapp.status()[source]

Check the status of Plugger.

This is useful for a healthcheck from Docker, and may have many other uses in the future.

Returns:
dict

A dictionary of the status.

Examples

>>> status()
Code.webapp.translations()[source]

Serve the translations.

Returns:
Response

The translations.

Examples

>>> translations()