summaryrefslogtreecommitdiff
path: root/credentials/imappwd.py
blob: 8570a5ffed75fc9b17f1346072d4e96af8a4ab78 (plain)
1
2
3
4
5
6
7
8
9
10
11
import os.path
import subprocess
home = os.path.expanduser("~")
def mailpasswd(acct):
  acct = os.path.basename(acct)
  path = "%s/.config/mutt/credentials/%s.gpg" % (home,acct)
  args = ["gpg", "--use-agent", "--quiet", "--batch", "-d", path]
  try:
    return subprocess.check_output(args).strip()
  except subprocess.CalledProcessError:
      return ""