mutt-wizard/bin/imappwd.py

12 lines
372 B
Python
Raw Normal View History

2018-02-10 07:47:29 +01:00
import os.path
import subprocess
home = os.path.expanduser("~")
def mailpasswd(acct):
acct = os.path.basename(acct)
2019-02-21 16:14:17 +01:00
path = "%s/.local/share/muttwizard/%s.gpg" % (home,acct)
2018-02-13 21:00:48 +01:00
args = ["gpg2", "--use-agent", "--quiet", "--batch", "-d", path]
2018-02-10 07:47:29 +01:00
try:
2019-02-19 14:14:17 +01:00
return subprocess.check_output(args).strip().decode('UTF-8')
2018-02-10 07:47:29 +01:00
except subprocess.CalledProcessError:
return ""