Why cant map the url to my request handler
('/\d+\?fmt=json',JsonHandler)
class JsonHandler(webapp.RequestHandler):
def get(self):
self.response.out.write("hello"开发者_运维技巧)
Hey, I am using google app engine python and tring to map the url to my request handler. The url is digits followed by ?fmt=json, but it just doesnt print out "hello" and the regex test returns true, say 1234?fmt=json. any help? thank you
You shouldn't include the query parameter in the regex.
('/\d+',JsonHandler)
class JsonHandler(webapp.RequestHandler):
def get(self):
if self.request.get("fmt") == "json": #check the query string in the get handler
self.response.out.write("hello")
精彩评论