Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialPaul Bentham
24,090 PointsI've put in exactly as per the video on the challenge but it's coming up with an error? is there a bug in this?
My code is as below: from flask import Flask from flask import request
app = Flask(__name__)
@app.route('/')
def index(name='Treehouse'):
name=requests.args.get('name', name)
return 'Hello {}'.format(name)
3 Answers
Kenneth Love
Treehouse Guest TeacherYou have requests
on your name=
line. You probably want request
(no "s").
Saurabh Kolhe
Courses Plus Student 912 Pointsfrom flask import Flask
from flask import request
app = Flask(__name__)
@app.route('/')
def index(name = "Saurabh"):
name = request.args.get('name',name)
return "Hello {name}".format(name)
I input this in the challenge and it still doesnt work.
I get the response " Bummer! '/' gave a non-200 response. Did you change the route?" Any idea whats wrong?
Adrian Wisaksana
8,070 PointsInstead of having
return "Hello {name}".format(name)
I think it should just be
return "Hello {}".format(name)
Hope that helps!
Ivars Jaundzeikars
8,224 Pointsor
return "Hello {name}".format(name=name)
using .format method with kwargs. Maybe not the most conventional way but that's how I did it.
william parrish
13,774 PointsWhich challenge is it, what are they asking you to do?
Paul Bentham
24,090 PointsIt's in the flask basics course, the "request args" challenge.
Paul Bentham
24,090 PointsPaul Bentham
24,090 PointsThanks Kenneth! (always the little things that catch us out)