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

Skip Montanaro skip.montanaro at gmail.com
Sat Apr 15 09:43:13 EDT 2017


Thanks for the pointer. I've been away from any sort of web
development for a long while. Things have changed quite a bit since
the days of cgi.FieldStorage.

For you young'uns out there, the Python documentation for the cgi
module shows how we used to get things done. Everyone had the print
statement and a bunch of angle brackets in their toolkit. Seems quaint
now. :-)

https://docs.python.org/2/library/cgi.html


On Sat, Apr 15, 2017 at 8:34 AM, Scott Werner <scott.werner.vt at gmail.com> wrote:
> 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


More information about the Flask mailing list