added errors 400 and 404

This commit is contained in:
Your Name 2021-01-06 21:20:01 +01:00
parent f8a531b905
commit c5b3bf91ad

13
api.py
View File

@ -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()