So I have a flask URL, where there are 2 separate arguments. I want to run the same function with either no arguments, just the first or both. If no specific value is set, I want the unaccounted for arguments to get value None (as opposed to just not existing at all).
My current solution involves using 3 @app.route statements, and I was wondering if there was something more efficient i've missed.
@app.route('/URL',defaults={'Arg1':None,'Arg2':None})
@app.route('/URL/<string:Arg1>',defaults={'Arg2':None})
@app.route('/URL/<string:Arg1>/<string:Arg2>')
Thanks!
request.args.get('argname')in my handler method but that's just because I didn't know that what you do is even possible