From c5b3bf91ad85a1aa44bce4a9f6442206c1dd9bb4 Mon Sep 17 00:00:00 2001 From: Your Name Date: Wed, 6 Jan 2021 21:20:01 +0100 Subject: [PATCH] added errors 400 and 404 --- api.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/api.py b/api.py index cb62afa..698bfc6 100644 --- a/api.py +++ b/api.py @@ -1,5 +1,6 @@ import flask, random, datetime, json from flask import request, jsonify +import sqlite3 app = flask.Flask(__name__, static_url_path='', static_folder='static') app.config["DEBUG"] = True @@ -174,4 +175,16 @@ def api_args(): json.dump(slogans, sloganjson) return jsonify(buildDictElem['refusal_message']) + +@app.errorhandler(400) +def page_not_found(e): + + return jsonify(build_error_two()) + +@app.errorhandler(404) +def page_not_found(e): + return jsonify(build_error_two()) + + + # app.run()