On Tue, Feb 10, 2015 at 20:33:04 -0800, Harold Carr wrote: > QUESTION: Is there a way to have it NOT store passwords, instead prompting? > > Note: I do not know the Python ecosystem (so if you explain that ofxclient > uses keyring for passwords, I don't know what keyring does).
When I wanted to do something similar with another program, I found that
replacing the keyring module (gnomekeyring in that case) with a stub was
the easiest way. For example, save the attached file in $HOME/key-stub,
then run
export PYTHONPATH=$HOME/key-stub${PYTHONPATH+:$PYTHONPATH}
before running ofxclient.
You'll need gpg-agent (in the 'gnupg-agent' package on Debian) installed
and running. If you set 'id' to any non-blank string, it will cache the
passphrase in RAM for a while. I didn't test with ofxclient--you should
fix up the prompts based on the actual 'keyring' and 'option' parameters
you see, and maybe add some error-handling.
-- Michael
--
---
You received this message because you are subscribed to the Google Groups
"Ledger" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.
# copyright waived as per CC0: # https://creativecommons.org/publicdomain/zero/1.0/legalcode-plain import io, os, subprocess try: import urllib.parse as urllib_parse except ImportError: import urllib as urllib_parse def enc(value): if value=='X': return b'%58' return urllib_parse.quote_plus(value).encode('utf8') or b'X' def set_password(*v): pass def delete_password(*v): pass def get_password(keyring, option): (id, error, prompt, desc) = ('', '', 'Password for '+option, 'foo') (r,w) = os.pipe() with io.open(r,'rb') as r, io.open(w,'wb') as w: w.write( b'GET_PASSPHRASE --data %s %s %s %s\n' % tuple(enc(x) for x in (id, error, prompt, desc)) ) w.close() data = subprocess.check_output(['gpg-connect-agent'], stdin=r) lines = data.split(b'\n') if lines[0].startswith(b'D ') and lines[1] == b'OK': return urllib_parse.unquote(lines[0][2:])
signature.asc
Description: Digital signature
