On Sun, Jan 17, 2016 at 6:13 PM, sudipto manna <sudipto...@gmail.com> wrote: > Here is the code snippet: > > File#FlaskTest2.py > > from flask import Flask > > app = Flask(__name__) > > #Make an app.route() decorator here > @app.route("/puppies/", methods = ['GET' , 'POST']) > def puppiesFunction(): > if request.method == 'GET': > return getAllPuppies()
Hi Sudipto, I don't know the Flask framework here, but this code looks suspicious. What is "request" in this puppiesFunction definition? It's not a parameter. Where does it come from? Is it a global? http://flask.pocoo.org/docs/0.10/quickstart/#accessing-request-data ... oh. It is a module global. That is not something I like philosophically, but oh well, roll with it... Do you have other working examples from prior code that used requests? If so, you may want to double check them. You're missing a definition that you need to add to your program. Take a look at the documentation: read the "The Request Object" section in the docs, and you should see the missing line that you need to add to your program. If you can't find it after you've read this quickstart documentation, please feel free to ask the mailing list. But you should be able to see it: it's the first boxed piece of code at: http://flask.pocoo.org/docs/0.10/quickstart/#the-request-object Good luck! _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor