def handle_500(e): """General Error Page""" client_addr = get_ipaddr() count_errors.labels(500, e, client_addr, None, None, None).inc() logger.error(f"Error: {e}, Source: {client_addr}") html = render.html("500") return html, 500
def handle_429(e): """Renders full error page for too many site queries""" html = render.html("429") client_addr = get_ipaddr() count_ratelimit.labels(e, client_addr).inc() logger.error(f"Error: {e}, Source: {client_addr}") return html, 429
def handle_404(e): """Renders full error page for invalid URI""" html = render.html("404") path = request.path client_addr = get_ipaddr() count_notfound.labels(e, path, client_addr).inc() logger.error(f"Error: {e}, Path: {path}, Source: {client_addr}") return html, 404
def test_route(): """Test route for various tests""" html = render.html("500") return html, 500
def site(): """Main front-end web application""" html = render.html("index") return html