passwdtools/pwdfile.py

17 lines
379 B
Python
Raw Normal View History

2019-03-12 12:27:34 +00:00
from configuration import Config
import json
class Pwdfile:
def __init__(self):
2019-03-12 13:14:12 +00:00
self.pwdsfile = Config().get_pwdfilename()
2019-03-12 12:27:34 +00:00
def read(self):
2019-03-12 13:14:12 +00:00
with open(self.pwdsfile, mode="r") as pwddata:
return json.load(pwddata)
2019-03-12 12:27:34 +00:00
def write(self, keys):
2019-03-12 13:14:12 +00:00
with open(self.pwdsfile, mode="w") as pwddata:
pwddata.write(json.dumps(keys))
2019-03-12 12:27:34 +00:00