from flask import jsonify, abortdef json_abort(status_code, message): data = { 'error': { 'code': status_code, 'message': message } } response = jsonify(data) response.status_code = status_code abort(response)
NOTE: Compatiple format with Google API Design