Browse Source

added errors 400 and 404

master
Your Name 4 years ago
parent
commit
c5b3bf91ad
  1. 13
      api.py

13
api.py

@ -1,5 +1,6 @@
import flask, random, datetime, json import flask, random, datetime, json
from flask import request, jsonify from flask import request, jsonify
import sqlite3
app = flask.Flask(__name__, static_url_path='', static_folder='static') app = flask.Flask(__name__, static_url_path='', static_folder='static')
app.config["DEBUG"] = True app.config["DEBUG"] = True
@ -174,4 +175,16 @@ def api_args():
json.dump(slogans, sloganjson) json.dump(slogans, sloganjson)
return jsonify(buildDictElem['refusal_message']) 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() # app.run()

Loading…
Cancel
Save