def post(self): testflg = self.get_argument('testflg') hostname = self.get_argument('hostname') operator = self.get_argument('operator') calltype = self.get_argument('calltype') frequency = self.get_argument('frequency') language = self.get_argument('language') message = self.get_argument('message') headid = self.get_argument('headid') footid = self.get_argument('footid') addressee = self.request.arguments['addressee'] self.set_header("Content-Type", "application/json;charset=utf-8") result = self.checkinput(testflg, hostname, operator, calltype, frequency, language, message, headid, footid, addressee) if result == False: response = '{\"success\":\"false\",\"error\":\"%s\"}' % define.ERROR_CODE['parameters'] self.write(response) else: main = barista() eventid = main.firstRegist(testflg, hostname, operator, calltype, frequency, language, message, headid, footid, addressee) if eventid == '': response = '{\"success\":\"false\",\"error\":\"%s\"}' % define.ERROR_CODE['connection'] self.write(response) response = '{\"success\":\"true\",\"eventid\":\"%s\"}' % eventid self.write(response)
def getlog(): db = sqlitedb() eventids = db.gettestevent() #print eventids main = barista() result = main.getLog(eventids[0]['eventid']) print result.encode('utf-8')
def get(self): eventid = self.get_argument('eventid') self.set_header("Content-Type", "application/json;charset=utf-8") if eventid == '': logging.info('input parameter error testflg') response = '{\"success\":\"false\",\"error\":\"%s\"}' % define.ERROR_CODE['parameters'] else: main = barista() result = main.getLog(eventid) self.write(result)