Reading an entry from a python program

Asked by Fredrik Arnerup on 2015-09-22

I'm thinking of using my passwordsafe db for storing my mail password and letting offlineimap look it up using a python hook.
Is this a good way of reading a password entry, or is there a better one?

import pasaffe_lib.readdb as readdb
f = readdb.PassSafeFile("file.psafe3", "password")
user, password = next((e[4], e[6]) for e in f.records.values() if e[3]=="mail")

Question information

Language:
English Edit question
Status:
Solved
For:
Pasaffe Edit question
Assignee:
No assignee Edit question
Solved by:
Fredrik Arnerup
Solved:
2015-09-22
Last query:
2015-09-22
Last reply:
2015-09-22
Marc Deslauriers (mdeslaur) said : #1

That's the best way for now. I know someone is currently working on a command-line utility for Pasaffe, but it's not available yet.

The only issue is that you have to hardcode your password there, but I assume you are ok with doing that.

Fredrik Arnerup (arnerup) said : #2

Ok. I wasn't going to hardcode the the password anyway.
It would be nice to be able to use pasaffe as a password agent instead of gnome-keyring.