pyra.webapp#

Responsible for serving the webapp.

pyra.webapp.callback_dashboard() Response[source]#

Get dashboard data.

This should be used in a callback in order to update charts in the web app.

Returns:
Response

A response formatted as flask.jsonify.

See also

pyra.hardware.chart_data

This function sets up the data in the proper format.

Examples

>>> callback_dashboard()
<Response ... bytes [200 OK]>
pyra.webapp.docs(filename) send_from_directory[source]#

Serve the Sphinx html documentation.

Todo

This documentation needs to be improved.

Parameters:
filenamestr

The html filename to return.

Returns:
flask.send_from_directory

The requested documentation page.

Notes

The following routes trigger this function.

/docs/ /docs/<page.html>

Examples

>>> docs(filename='index.html')
pyra.webapp.favicon() send_from_directory[source]#

Serve the favicon.ico file.

Todo

This documentation needs to be improved.

Returns:
flask.send_from_directory

The ico file.

Notes

The following routes trigger this function.

/favicon.ico

Examples

>>> favicon()
pyra.webapp.home() render_template[source]#

Serve the webapp home page.

Todo

This documentation needs to be improved.

Returns:
render_template

The rendered page.

Notes

The following routes trigger this function.

/ /home

Examples

>>> home()
pyra.webapp.start_webapp()[source]#

Start the webapp.

Start the flask webapp. This is placed in it’s own function to allow the ability to start the webapp within a thread in a simple way.

Examples

>>> start_webapp()
 * Serving Flask app 'pyra.webapp' (lazy loading)
...
 * Running on http://.../ (Press CTRL+C to quit)
>>> from pyra import threads
>>> threads.run_in_thread(target=webapp.start_webapp, name='Flask', daemon=True).start()
 * Serving Flask app 'pyra.webapp' (lazy loading)
...
 * Running on http://.../ (Press CTRL+C to quit)
pyra.webapp.status() dict[source]#

Check the status of RetroArcher.

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

Returns:
dict

A dictionary of the status.

Examples

>>> status()
pyra.webapp.test_logger() str[source]#

Test logging functions.

Check ./logs/pyra.webapp.log for output.

Returns:
str

A message telling the user to check the logs.

Notes

The following routes trigger this function.

/test_logger

Examples

>>> test_logger()