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°C, %.2f°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()
|