Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Flask view raises TypeError got unexpected keyword argument

Tags:

python

flask

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)
like image 639
Augusto Vera Avatar asked May 11 '17 20:05

Augusto Vera


1 Answers

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):
like image 143
davidism Avatar answered Sep 28 '22 03:09

davidism