Reading an entry from a python program

Asked by Fredrik Arnerup

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:
Last query:
Last reply:
Revision history for this message
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.

Revision history for this message
Fredrik Arnerup (arnerup-deactivatedaccount) 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.