import flask

from cauldron.cli.server import run as server_runner
from cauldron.ui import arguments
from cauldron.ui import statuses


@server_runner.APPLICATION.route('/ui-status', methods=['POST'])
def ui_status():
    args = arguments.from_request()
    last_timestamp = args.get('last_timestamp', 0)
    force = args.get('force', False)
    results = statuses.get_status(last_timestamp, force)
    return flask.jsonify(results)

[((8, 1, 8, 64), 'cauldron.cli.server.run.APPLICATION.route', 'server_runner.APPLICATION.route', (), '', True, 'from cauldron.cli.server import run as server_runner\n'), ((10, 11, 10, 35), 'cauldron.ui.arguments.from_request', 'arguments.from_request', ({}, {}), '()', False, 'from cauldron.ui import arguments\n'), ((13, 14, 13, 56), 'cauldron.ui.statuses.get_status', 'statuses.get_status', ({(13, 34, 13, 48): 'last_timestamp', (13, 50, 13, 55): 'force'}, {}), '(last_timestamp, force)', False, 'from cauldron.ui import statuses\n'), ((14, 11, 14, 33), 'flask.jsonify', 'flask.jsonify', ({(14, 25, 14, 32): 'results'}, {}), '(results)', False, 'import flask\n')]