2013-09-01 122 views
0

我試圖從URL傳遞一些參數到我的谷歌應用程序引擎Python應用程序類的方法,但我沒有得到打印的參數。 這裏是Python代碼無法將URL參數傳遞到GAE中的類方法python

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) 

這裏是URL www.example.com/checkResponse?Id=10&Res=Yes 1)爲什麼不獲取打印RESP。 2)我也想知道是否有方法直接打印傳入參數的值而不解析響應url。

回答

0

看一看這個文件讓喜歡你的ID和RES請求數據:http://webapp-improved.appspot.com/guide/request.html

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) 
+0

已經做到了,DAT是我如何與上面的代碼來了......如果可以的話將是有益的你指出了一些具體的東西 – iJade

+0

更新了我的答案 – voscausa

+0

更新了我的答案,正則表達式更改爲 – voscausa