I am having problems defining my own error custom messages. I am not exactly sure if I am doing it correctly but I am trying to follow the documentation:
http://flask-restful.readthedocs.org/en/latest/extending.html#define-custom-error-messages
This is what my code looks like:
from flask import Flask
from flask.ext import restful
myerrors = {
'CannotFind':{
'message':'We could not find it!',
'status':404
}
}
app = Flask(__name__)
api = restful.Api(app, errors = myerrors)
However when, I run this program i get an error:
TypeError: __init__() got an unexpected keyword argument 'errors'
The docs says Once your errors dictionary is defined, simply pass it to the Api constructor thats what I did no?
I also noticed in the documentation they used:
api = flask_restful.Api(app, errors=errors)
so I thought I was using something incorrectly and therefore I tried to import that flask_restful but it doesn't exists...
So now I am confused, please help!