在 python 中向 keepass 记录添加附加属性

Add additional attribute to keepass record in python

我正在使用 pykeepass 对数百个 keepass 文件进行批量修改,我想向 keepass 条目添加一些额外的属性。

我试过这样做:

def updateRecord(record, recordParent, recordGrandparent, recordGreatGrandparent, kdbxHandle):
   record.custom_properties["keepass2"] = recordGrandparent
   record.custom_properties["keepass3"] = recordGreatGrandparent
   kdbxHandle.save()
   return record

但这具有零效果(没有错误消息,什么都没有)。根据我的理解 record.custom_properties 是一个我应该能够修改的字典。

我需要做什么,才能使用 pykeepass 向 keepass 文件添加额外的属性?

谢谢!

好的,我可以回答我自己的问题 - 设置自定义 属性 是这样完成的:

record.set_custom_property("keepass2", recordGrandparent)