MANUAL: add minor sample on how to retrieve a password with a helper python file

Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
This commit is contained in:
Nicolas Sebrecht 2015-01-10 01:51:10 +01:00
parent 16baabdeaa
commit bd0461a986

View File

@ -562,6 +562,16 @@ pythonfile with::
pythonfile=~/bin/offlineimap-helpers.py pythonfile=~/bin/offlineimap-helpers.py
Here is a basic content sample::
import commands
def get_password(account_name):
cmd = "security find-internet-password -w -a '%s'"% account_name
(status, output) = commands.getstatusoutput(cmd)
return output
From this sample, replace the cmd line with whatever can retrieve your password.
Your pythonfile needs to contain implementations for the functions Your pythonfile needs to contain implementations for the functions
that you want to use in offflineimaprc. The example uses it for two that you want to use in offflineimaprc. The example uses it for two
purposes: Fetching passwords from the gnome-keyring and translating purposes: Fetching passwords from the gnome-keyring and translating