Python Flask Basics Welcome to Flask Request args

Sarah Burgart
Sarah Burgart
5,159 Points

gave a non-200 response - get name argument - did you change route?

I saw a few other questions/ help with this - and can't see what I am doing wrong?

flask_app.py
from flask import Flask
from flask import request

app = Flask(__name__)

@app.route('/')
def index(name = 'Treehouse'):
    name = request.args.get('name', name)
    return 'Hello {name}'.format(name)

1 Answer

With the format method the curly braces used for place holders are empty. Try:

return 'Hello {}'.format(name)
Sarah Burgart
Sarah Burgart
5,159 Points

Oi. Thanks! I usually employ f"Hello {name}"