/
ilya.petrash
/
SimplePyScripts
Обзор
Документация
Войти
/
ilya.petrash
/
SimplePyScripts
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
webserver__cherrypy__examples/expose_methods.py
29 строк
761 B
gil9red
Refactoring. Using black code style
28 июн 2023, 15:50
28 июн 2023, 15:50
1843c66
Код
Авторство
О чём код?
#!/usr/bin/env python3 # -*- coding: utf-8 -*- __author__ = "ipetrash" # SOURCE: https://github.com/cherrypy/cherrypy/blob/master/cherrypy/tutorial/tut02_expose_methods.py import cherrypy class HelloWorld: @cherrypy.expose def index(self): # Let's link to another method here. return 'We have an <a href="show_msg">important message</a> for you!' @cherrypy.expose def show_msg(self): # Here's the important message! return "Hello world!" if __name__ == "__main__": # CherryPy always starts with app.root when trying to map request URIs # to objects, so we need to mount a request handler root. A request # to '/' will be mapped to HelloWorld().index(). cherrypy.quickstart(HelloWorld())