Multiple questions have been asked with a similar error on SO. I have tried all of the solutions but still keep getting a beautiful error:
werkzeug.exceptions.HTTPException.wrap..newcls: 400 Bad Request: KeyError: 'username'
Below is my html form:
<form action='/login' method = "GET">
    <label>Name: </label>
    <input name="username" type="text">
    <input type="submit" name='submit' value='submit'>
</form>
Here is the function that deals with the form data:
@app.route('/login', methods = ['GET'])
def login():
    if request.method == "GET":
        un = request.form['username']
        return un
I have learned Bottle and transitioning towards Flask. So far, I have tried the following: 1) GET to POST 2) request.form.get('username', None) 3) Add POST reason to the function route without any rhyme or reason.
Can somebody help me out?
 
     
     
    