def api_percentage(percentage): if 0 <= percentage <= 100: response.content_type = 'text/plain' formatted_list, not_needed_length = trackon.list_uptime(percentage) return formatted_list else: abort(400, "The percentage has to be between 0 an 100")
def api_percentage(percentage): if 0 <= percentage <= 100: add_api_headers() formatted_list, not_needed_length = trackon.list_uptime(percentage) return formatted_list else: # abort(400, "The percentage has to be between 0 an 100") Abort does not allow custom headers raise HTTPError(status=400, body="The percentage has to be between 0 an 100", headers={"Access-Control-Allow-Origin": "*"})
def api_percentage(percentage): if 0 <= percentage <= 100: formatted_list, not_needed_length = trackon.list_uptime(percentage) resp = make_response(formatted_list) resp = add_api_headers(resp) return resp else: abort( Response("The percentage has to be between 0 an 100", 400, headers={'Access-Control-Allow-Origin': '*'}))
def list_stable(): stable_list, size = trackon.list_uptime(95) return render_template('list.mako', stable=stable_list, size=size, active='list')
def list_stable(): stable_list, size = trackon.list_uptime(95) return template('tpl/list.mako', stable=stable_list, size=size)