Reputation: 3442
I was trying to create a catch-all route with flask, using this snippet: http://flask.pocoo.org/snippets/57/
from flask import Flask
app = Flask(__name__)
@app.route('/api/v1/<path:path>')
def api():
return 'You want path: %s' % path
if __name__ == '__main__':
app.run()
But got this error when running it in my app:
got an unexpected keyword argument 'path'
Upvotes: 3
Views: 2605
Reputation: 3442
I forgot to add path as a parameter in my function:
def api(path)
@app.route('/api/v1/<path:path>')
def api(path): <---
return 'You want path: %s' % path
Upvotes: 4