Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

use keychain provided by Mac OS X in offlineimap to retrieve password

  • Loading branch information...
commit 68ee7edb6b1eb9191985db4aaf49b95177e79769 1 parent 4950a02
@linsong authored
Showing with 11 additions and 2 deletions.
  1. +11 −2 .offlineimap.py
View
13 .offlineimap.py
@@ -1,5 +1,14 @@
import os
def get_imap_passwd():
- cmd = "/Applications/MacPorts/CocoaDialog.app/Contents/MacOS/CocoaDialog secure-standard-inputbox --string-output --title 'OfflineIMAP: please input your password'"
- return os.popen(cmd).readlines()[1][:-1]
+ #cmd = "/Applications/MacPorts/CocoaDialog.app/Contents/MacOS/CocoaDialog secure-standard-inputbox --string-output --title 'OfflineIMAP: please input your password'"
+ #return os.popen(cmd).readlines()[1][:-1]
+
+ cmd = "/usr/bin/security 2>&1 >/dev/null find-generic-password -a OfflineIMAP -g"
+ line = os.popen(cmd).readline()
+ passwds = line.split()
+ if len(passwds) == 2:
+ return passwds[1][1:-1]
+ else:
+ return ""
+
Please sign in to comment.
Something went wrong with that request. Please try again.