Beispiel #1
0
    def put(self, id, data):
        http_master_rsp = self.master_api.put(id, data)
        if http_master_rsp["status"] == 202:
            self.logger.info("Master Api: " + http_master_rsp["message"])
            return http_master_rsp
        eror = "Master Api: " + http_master_rsp["message"] + "\n"
        self.logger.warning("Master Api: " + http_master_rsp["message"])

        if API["slave"]["ACTIVE"]:
            slave_api = ApiProfileDAL("slave")
            http_slave_rsp = slave_api.put(id, data)
            if http_slave_rsp["status"] == 202:
                self.logger.info("Slave Api: " + http_slave_rsp["message"])
                return http_slave_rsp
            else:
                eror += "Slave Api: " + http_slave_rsp["message"] + "\n"
                self.logger.warning("Slave Api: " + http_slave_rsp["message"])

        if DATABASE["master"]["ACTIVE"]:
            master_db = DbProfileDAL("master")
            db_rsp = master_db.put(id, data)
            if db_rsp["status"] == 202:
                self.logger.info("Database: " + db_rsp["message"])
                return db_rsp
            else:
                eror += "Database: " + db_rsp["message"] + "\n"
                self.logger.warning("Database: " + db_rsp["message"])
        print eror
        self.logger.error(eror)
        return http_master_rsp
Beispiel #2
0
    def get_video_check_list(self):
        http_master_rsp = self.master_api.get_video_check_list()
        if http_master_rsp["status"] == 200:
            self.logger.info("Master Api: " + http_master_rsp["message"])
            return http_master_rsp
        eror = "Master Api: " + http_master_rsp["message"] + "\n"
        self.logger.warning("Master Api: " + http_master_rsp["message"])

        if API["slave"]["ACTIVE"]:
            slave_api = ApiProfileDAL(config.SLAVE_API)
            http_slave_rsp = slave_api.get_video_check_list()
            if http_slave_rsp["status"] == 200:
                self.logger.info("Slave Api: " + http_slave_rsp["message"])
                return http_slave_rsp
            else:
                eror += "Slave Api: " + http_slave_rsp["message"] + "\n"
                self.logger.warning("Slave Api: " + http_slave_rsp["message"])

        if DATABASE["master"]["ACTIVE"]:
            master_db = DbProfileDAL("master")
            db_rsp = master_db.get_video_check_list()
            if db_rsp["status"] == 200:
                self.logger.info("Database: " + db_rsp["message"])
                return db_rsp
            else:
                eror += "Database: " + db_rsp["message"] + "\n"
                self.logger.warning("Database: " + db_rsp["message"])
        print eror
        self.logger.error(eror)
        return http_master_rsp
Beispiel #3
0
 def __init__(self):
     self.logger = logging.getLogger(__name__)
     self.master_api = ApiProfileDAL("master")