Relatively simple, directly on the code:
Import Weburls = ( '/', ' hello ') app = Web.application (URLs, Globals ()) class Hello: def GET (self): print Web.input () return ' GET Hello World ' def post: print web.input () return "POST Hello World" if __ name__ = = ' __main__ ': app.run ()
Save this piece of code and run it. Then enter in the browser:
http://127.0.0.1:8080/?name=instant7&passward=ins&date=2014.11.4
You can see the following records in the Python console:
<storage {' Date ': U ' 2014.11.4 ', ' name ': U ' instant7 ', ' Passward ': U ' ins '}>
127.0.0.1:16193--[04/nov/2014 14:34:20] "http/1.1 GET/"-OK
At this point, the get parameters are successfully obtained
If you want to get a parameter value in your code, refer to the following example:
i = web.input () name = I.namepassword = I.passworddate = i.dateprint name, password, date
Get get parameters under web.py