kiln_controller/kiln/server.py

20 wiersze
543 B
Python
Czysty Zwykły widok Historia

2014-10-15 18:23:03 +00:00
import time
import tornado.ioloop
import tornado.web
class MainHandler(tornado.web.RequestHandler):
2014-10-16 07:46:04 +00:00
def initialize(self, monitor):
self.monitor = monitor
2014-10-15 18:23:03 +00:00
def get(self):
self.write("<!doctype html><head><meta http-equiv='refresh' content='5' ></head><p>Current temperature: %.2f&deg;C, %.2f&deg;F"%read_temp())
if __name__ == "__main__":
2014-10-16 07:46:04 +00:00
application = tornado.web.Application([
(r"/", MainHandler, dict(monitor=mon)),
])
2014-10-15 18:23:03 +00:00
application.listen(8888)
tornado.ioloop.IOLoop.instance().start()