Integrating a permanent keyring storage system into your python app is now drop dead simple.
From pypi.python.org, “The Python keyring lib provides a easy way to access the system keyring service from python. It can be used in any application that needs safe password storage.”
$ easy_install keyring $ pip install keyring
$ wget http://pypi.python.org/packages/source/k/keyring/keyring-0.2.tar.gz $ hg clone http://bitbucket.org/kang/python-keyring-lib/
Store a password:
$ python
>>> import keyring
>>> keyring.set_password("myapp", "sventek", "krmit")
Now quit (ctrl-d) and start over. You should be able to access the password, like this:
$ python >>> import keyring >>> keyring.get_password( "myapp", "sventek" ) 'krmit' >>>
Python keyring library was created as a Google Summer of Code project. The keyring lib supports Windows win32crypto, Mac OS X’s SXKeychain, KDE’s KWallet, Gnome’s keyring, and encrypted or unencrypted password files. When your application wants to store or fetch data from the keyring, it will just work.
This is exactly what I needed — but if easy mode doesn’t suite you and you want/need to make your own backend or specify a specific keyring to use, you can do that by calling set_keyring() or specifying it in a config.