/pykeepass

Low-level library to interact with keepass databases (supports the v.4 format)

Primary LanguagePythonGNU General Public License v3.0GPL-3.0

pykeepass

This library allows you to write entries to a KeePass database

pykeepass does not currently support Python 3

Simple Example

Finding Entries

The supported find commands are listed below

  • find_entries_by_title (title, regex=False, tree=None, history=False, first=False)
  • find_entries_by_username (username, regex=False, tree=None, history=False, first=False)
  • find_entries_by_password (password, regex=False, tree=None, history=False, first=False)
  • find_entries_by_url (url, regex=False, tree=None, history=False, first=False)
  • find_entries_by_notes (notes, regex=False, tree=None, history=False, first=False)
  • find_entries_by_path (path, regex=False, tree=None, history=False, first=False)

where title, username, password, url, notes and path are strings. These functions have an optional regex boolean argument which means to interpret the string as an XSLT style regular expression.

The history (default False) boolean controls whether history entries should be included in the search results.

The first (default False) boolean controls whether to return the first matched item, or a list of matched items. * if first=False, the function returns a list of Entry s or [] if there are no matches * if first=True, the function returns the first Entry match, or None if there are no matches

  • entries

a flattened list of all entries in the database

Finding Groups

  • find_groups_by_name (name, tree=None, regex=False, first=False)
  • find_groups_by_path (path, tree=None, regex=False, first=False)

where name and path are strings. These functions have an optional regex boolean argument which means to interpret the string as an XSLT style regular expression.

The first (default False) boolean controls whether to return the first matched item, or a list of matched items. * if first=False, the function returns a list of Group s or [] if there are no matches * if first=True, the function returns the first Group match, or None if there are no matches

  • root_group

the Root group to the database

  • groups

a flattened list of all groups in the database

Adding Entries

  • add_entry (destination_group, title, username, password, url=None, notes=None, tags=None, icon=None, force_creation=False)

This function adds a new entry to the existing group destination_group.

destination_group is a Group instance. title, username, password, url, notes, tags, icon are strings.

Adding Groups

  • add_group (destination_group, group_name)

This function adds a new group to the existing group destination_group.

destination_group is a Group instance. group_name is a string.