无法将url参数传递到GAE python中的类方法中
我试图将一些参数从URL传递到我的google app engine Python apps类方法,但我没有打印这些参数。 下面是python代码无法将url参数传递到GAE python中的类方法中,python,google-app-engine,python-2.7,Python,Google App Engine,Python 2.7,我试图将一些参数从URL传递到我的google app engine Python apps类方法,但我没有打印这些参数。 下面是python代码 class CheckResponse(webapp.RequestHandler): def get(self, resp): self.response.headers['Content-Type'] = 'text/plain' self.response.write(resp) applic
class CheckResponse(webapp.RequestHandler):
def get(self, resp):
self.response.headers['Content-Type'] = 'text/plain'
self.response.write(resp)
application = webapp2.WSGIApplication([
('/mail', MainPage),
('/', ShowHome),
('/checkResponse?(.*)', CheckResponse)
], debug=True)
下面是URLwww.example.com/checkResponse?Id=10&Res=Yes
1) 为什么resp没有打印出来。
2) 我还想知道是否有办法直接打印传入参数的值,而无需解析响应url。查看此文档以获取请求数据,如您的ID和Res:
已经做了,dat是我如何得到上述代码的…如果你能特别指出一些事情,那将是很有帮助的
class CheckResponse(webapp2.RequestHandler): # webapp2
def get(self):
self.response.headers['Content-Type'] = 'text/plain'
self.response.write(self.request.GET['resp'])
application = webapp2.WSGIApplication([
('/mail', MainPage),
('/', ShowHome),
('/checkResponse', CheckResponse) # changed
], debug=True)