libkeepass / pykeepass

Python library to interact with keepass databases (supports KDBX3 and KDBX4)
https://pypi.org/project/pykeepass/
GNU General Public License v3.0
411 stars 96 forks source link

Question - How do I save meta data there isn't yet a method for? #317

Closed rtl19 closed 2 years ago

rtl19 commented 2 years ago

I have a .kdbx database file that was created using the open source keepass.exe executable. After looking at the database using your library, I noticed there were entries in there like: '/KeePassFile/Meta/DefaultUserName'.
If no formal method in the library exists for setting that value, is there a generic approach that I can use for any meta data value?

Evidlo commented 2 years ago

Yes, you should be able to do something like

# get DefaultUserName as an LXML element
default_username_elem =  kp._xpath('/KeePassFile/Meta/DefaultUserName', first=True)
default_username_elem.text = "foo"