[Flask] A bit confused about route decorator and optional parameters

Scott Werner scott.werner.vt at gmail.com
Sat Apr 15 09:34:20 EDT 2017


Forgot to hit reply all on my response:

https://webargs.readthedocs.io/ is an excellent package for parsing query
parameters and can also be used on paths.

Scott Werner
scott.werner.vt at gmail.com

On Apr 12, 2017 2:28 PM, "Skip Montanaro" <skip.montanaro at gmail.com> wrote:

> On Wed, Apr 12, 2017 at 1:22 PM, Harrison Wright <wright8191 at gmail.com>
> wrote:
> > @app.route("/func/<required_param>")
> > def my_func(required_param):
> >     func_you_have(required_param,
> >                               opt1=request.args.get('opt1'),
> >                               opt2=request.args.get('opt2'),
> >                               ...)
>
> Thank you. This seems to be exactly what I need. I was thinking the
> optional parameters had to be specified in the function signature.
>
> Skip
> _______________________________________________
> Flask mailing list
> Flask at python.org
> https://mail.python.org/mailman/listinfo/flask
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/flask/attachments/20170415/15caec03/attachment.html>


More information about the Flask mailing list