Guest User

Untitled

a guest
Jun 24th, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. import cherrypy
  2.  
  3. class HelloWorld:
  4. """ Sample request handler class. """
  5.  
  6. def index(self, **params):
  7. # CherryPy will call this method for the root URI ("/") and send
  8. # its return value to the client.
  9. for key in params:
  10. print key, '=', params[key]
  11. return "Hello world!"
  12.  
  13. # Expose the index method through the web. CherryPy will never
  14. # publish methods that don't have the exposed attribute set to True.
  15. index.exposed = True
  16.  
  17. # CherryPy always starts with app.root when trying to map request URIs
  18. # to objects, so we need to mount a request handler root. A request
  19. # to '/' will be mapped to HelloWorld().index().
  20. cherrypy.config.update({'server.socket_host': '127.0.0.1'})
  21. cherrypy.config.update({'server.socket_port': 8080})
  22. cherrypy.quickstart(HelloWorld(), '/')
Add Comment
Please, Sign In to add comment