User Tools

Site Tools


python:cherrypy_notes
no way to compare when less than two revisions

Differences

This shows you the differences between two versions of the page.


python:cherrypy_notes [2016/07/15 01:29] (current) – created mithat
Line 1: Line 1:
 +====== CherryPy Notes ======
  
 +Method names map to URLs. The following defines /index and /generate URLs:
 +<code python>
 +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())
 +</code>
python/cherrypy_notes.txt · Last modified: 2016/07/15 01:29 by mithat

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki