User Tools

Site Tools


python:cherrypy_notes

CherryPy Notes

Method names map to URLs. The following defines /index and /generate URLs:

import random
import string
 
import cherrypy
 
class StringGenerator(object):
    @cherrypy.expose
    def index(self):
        return "Hello world!"
 
    @cherrypy.expose
    def generate(self):
        return ''.join(random.sample(string.hexdigits, 8))
 
if __name__ == '__main__':
    cherrypy.quickstart(StringGenerator())
python/cherrypy_notes.txt · Last modified: 2016/07/15 01:29 by mithat

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki