Skip to content

Commit

Permalink
Add option to write to kdbx databases
Browse files Browse the repository at this point in the history
  • Loading branch information
wget committed Jul 28, 2017
1 parent 812f225 commit a1c9e14
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions libkeepass/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def getbuffer(self):
}

@contextmanager
def open(filename, **credentials):
def open(filename, readwrite=False, **credentials):
"""
A contextmanager to open the KeePass file with `filename`. Use a `password`
and/or `keyfile` named argument for decryption.
Expand All @@ -36,7 +36,7 @@ def open(filename, **credentials):
"""
kdb = None
try:
with io.open(filename, 'rb') as stream:
with io.open(filename, 'rb' if readwrite == False else 'r+b') as stream:
signature = common.read_signature(stream)
cls = get_kdb_reader(signature)
kdb = cls(stream, **credentials)
Expand Down

0 comments on commit a1c9e14

Please sign in to comment.