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

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

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

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

     pythonfile = ~/.offlineimap/

     [Repository rep-name]
     remotepasseval = osxkeychain("")

And here is my 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