__init__.py 文件源码

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

项目:keepass-menu 作者: frostidaho 项目源码 文件源码
def open(filename, **credentials):
    """
    A contextmanager to open the KeePass file with `filename`. Use a `password`
    and/or `keyfile` named argument for decryption.

    Files are identified using their signature and a reader suitable for 
    the file format is intialized and returned.

    Note: `keyfile` is currently not supported for v3 KeePass files.
    """
    kdb = None
    try:
        with io.open(filename, 'rb') as stream:
            signature = common.read_signature(stream)
            cls = get_kdb_reader(signature)
            kdb = cls(stream, **credentials)
            yield kdb
            kdb.close()
    except:
        if kdb:
            kdb.close()
        raise
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号