andrewb icon

web_test.py

andrewb | PRO | 06/26/16 03:49:26 AM UTC | 0 ⭐ | 845 👁️ | Never ⏰ | []
Python |

510 B

|

None

|

0 👍

/

0 👎

import web
import simplejson as json
 
urls = (
    '/', 'index',
    '/url', 'url',
    '/math', 'math'
)
 
class index:
    def GET(self):
        return 'hello, world'
 
class url:
    def GET(self):
        return 'url'
 
class math:
    def GET(self):
        return 'do math'
    
    def POST(self):
        data = web.data()
        j = json.loads(data)
        print j
        return j['a']+j['b']
    
if __name__ == "__main__":
    app = web.application(urls, globals())
    app.run()

Comments