Augusto Vera
Augusto Vera

Reputation: 203

Flask view raises TypeError got unexpected keyword argument

I'm trying to make a request to the following view. However, I get the error TypeError: echoplaca() got an unexpected keyword argument 'placa'.

@app.route(r'/enviaplaca/<placa>')
def echoplaca():
    return "Numero de placa: {}".format(placa)

Upvotes: 20

Views: 19755

Answers (1)

davidism
davidism

Reputation: 127190

You defined the route to be /enviaplaca/<placa>, but you defined the view function without the placa argument. The URL captures need to match the function arguments.

@app.route('/echoplaca/<placa>')
def echoplaca(placa):

Upvotes: 46

Related Questions