I'm making API and looking for a way to hide the extra information from the url. I have a function index:
@app.route('/', methods=['GET', 'POST'])
def index():
count = foo()
return redirect(url_for("result", count=count))
and a function result
@app.route("/done/<count>")
def result(count):
count = count
return jsonify(count=count)
Inner function count
allwase return different values. At the end I get a result like
http://127.0.0.1:5000/done/43
But I need more common url view for universal API like
http://127.0.0.1:5000/done
The problem is that if I remove <count>
from endpoint, i get error
TypeError: result() missing 1 required positional argument: 'count'
Is there a way to override this?