URI access parameters via webapp2

I want to access the URI parameters of this request:

http://localhost:8080/account/user?un=erik&pw=gaius 

I can not do the following code, though,

main.py

 app = webapp2.WSGIApplication([('/', MainPage), ('/account/user', account.User)], debug=True) 

account.py

 class User(webapp2.RequestHandler): def get(self, un, pw): self.response.headers['Content-Type'] = 'text/plain' self.response.write('Yey!' + un + ' ' + pw) 

I think something is wrong on my main.py, but I tried to link it by adding named routes and regular expressions, but I just kept getting 500 errors (internal server error).

+8
python google-app-engine webapp2
source share
1 answer
 class User(webapp2.RequestHandler): def get(self): un = self.request.get('un') pw = self.request.get('pw') self.response.headers['Content-Type'] = 'text/plain' self.response.write('Yey!' + un + ' ' + pw) 
+15
source share

All Articles