add_account.py 文件源码

python
阅读 24 收藏 0 点赞 0 评论 0

项目:Gnome-Authenticator 作者: bil-elmoussaoui 项目源码 文件源码
def read_database(self):
        """
            Read .yml database files provided by 2factorauth guys!
        """
        db_dir = path.join(env.get("DATA_DIR"), "applications") + "/data/*.yml"
        logging.debug("Database folder is {0}".format(db_dir))
        db_files = glob(db_dir)
        logging.debug("Reading database files started")
        for db_file in db_files:
            logging.debug("Reading database file {0}".format(db_file))
            with open(db_file, 'r') as data:
                try:
                    websites = yaml.load(data)["websites"]
                    for app in websites:
                        if self.is_valid_app(app):
                            self.db.append(app)
                except yaml.YAMLError as error:
                    logging.error("Error loading yml file {0} : {1}".format(
                        db_file, str(error)))
                except TypeError:
                    logging.error("Not a valid yml file {0}".format(db_file))
        logging.debug("Reading database files finished")
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号