Manual mentions "example file" with python function get_password; no such file

Tim Gray lists+offimap at protozoic.com
Wed Sep 21 20:20:58 BST 2011


On Sep 19, 2011 at 10:13 PM -0600, Iain Dalton wrote:
>But there's no offline-helpers.py or any file containing "get_password".

If it helps, here's the relevant bits from my .offlineimaprc file:

     [general]
     pythonfile = ~/.offlineimap/offlineimap.py

     [Repository rep-name]
     remotepasseval = osxkeychain("imap.mxes.net")

And here is my offlineimap.py file:

     #!/usr/bin/env python

     import subprocess as sb
     import shlex

     def osxkeychain(service, type="internet"):

         cmd = """/usr/bin/security find-%s-password -gs %s""" % (type, service)
         args = shlex.split(cmd)
         t = sb.check_output(args, stderr=sb.STDOUT)
         lines = t.split('\n')
         passwd = lines[0]
         passwd = passwd.split('"')[1]

         out = passwd
         return out

This is on OS X and accesses the system keychain through the 'security' 
command.  Just modify that file to call the appropriate command line 
utility and then parse the output so you just return the password.




More information about the OfflineIMAP-project mailing list