1

I have a flask route app.add_url_rule("/<string:name>",'welcome',DataProcessor.welcome) what I want is to make the name parameter optional. How can I do it inside the add_url_rule method?

swarnava112
  • 351
  • 8
  • 19

1 Answers1

0

app.add_url_rule() does exactly the same as the @app.route() decorator. Therefore, this answer might help you out.

In short, it's not possible without setting default values to those parameters.

You can either use that approach, or use the request.args.

Joost
  • 3,261
  • 1
  • 10
  • 27