I have a route that has two variable parts, and used defaults to specify default values for each part.
@app.route("/api/<a>/<b>", defaults={"a": 0, "b": 0})
def api(a, b):
return f"{a=}, {b=}"
I want to build a URL that overrides b while leaving a with the default value, /api/0/.
I tried excluding a, url_for("api", b=1), but got werkzeug.routing.BuildError: Could not build url for endpoint 'api' with values ['b']. Did you forget to specify values ['a']?. It seems that I can't exclude a variable, the default isn't substituted in.
Given that, I then tried calling with both variables, but got werkzeug.routing.BuildError: Could not build url for endpoint 'index.API.event_average_time_in_seconds' with values ['a', 'b'].. It seems I can't override both variables either.
How can I use defaults in my route to allow not passing values for all variables?