Python Flask Basics Welcome to Flask Request args

michael ernst
michael ernst
2,218 Points

Just trying to figure out where I went wrong.....I've rewatched the video several times. Where am I going wrong?

I feel as if I have written the same code as in the video. I definitely miss the hint button in this course. But I must be missing something somewhere because it's not coming up a pass. Anybody able to steer me in the right direction on what I must not be seeing?

flask_app.py
from flask import Flask
from flask import request

app = Flask(__name__)

@app.route('/')
def index(name="Treehouse"):
    return "Hello from {}".format(name) 

1 Answer

Rick Gleitz
Rick Gleitz
41,148 Points

The title of the challenge is Request Args, and it had you import requests (which you did). So you need to use request and args in a line before the return statement:

    name = request.args.get("name", name)

You also need to return the string the challenge wants: "Hello {}" versus "Hello from {}" (that would work in real life, but it won't pass the challenge). Hope this helps!

michael ernst
michael ernst
2,218 Points

thanks! ill try it out and see how it goes