示例#1
0
 def GET(self, request):
     channel = request.GET["channel"]
     begin = request.GET["begin"]
     msg_hander = get_hander(channel)
     msg_json = msg_hander.get(begin)
     rs = Response()
     rs.headers["Content-Type"] = "application/json"
     rs.body = msg_json
     return rs
示例#2
0
 def POST(self, request):
     channel = request.POST["channel"]
     msg = request.POST["msg"]
     channels.add(channel)
     msg_hander = get_hander(channel)
     point_json = msg_hander.post(msg)
     rs = Response()
     rs.headers["Content-Type"] = "application/json"
     rs.body = point_json
     return rs
示例#3
0
 def hup(*args):
     """Shuts down the server, but allows running 
     requests to complete, flush msg_hander
     """
     print "sighup received"
     running = False
     time.sleep(2)
     print channels
     for channel in channels:
         msg_hander = get_hander(channel)
         msg_hander.flash_write_force()
     sys.exit(0)