Thursday
Jul 26 2007
gnome-keyring with Python
The documentation on gnome-keyring I discovered helped me to access it successfully with Python. I've written a small module that fetches and stores a username and a password for some server.
Some notes:
The attributes are freeform, but there a some common attributes for network hosts. These are: "user", "domain", "server", "object", "protocol", "authtype", and "port". Actually there is a convenience API for network hosts.
libgnome-keyring requires that the application is correctly set using
g_set_application_name. Unfortunately the Python modulegnomekeyringdoes not do that for us and pygtk does not provide a function to set the application name. Therefore you need to include the modulegtkto make it work. (Filed as bug 460515.)Update:
g_set_application_namewas added to pygtk in the 2.13 development version.Python's
find_network_password_syncfunction does not allow None to be passed as arguments. The C API allows NULL to be passed here. This means that this function is basically unusable in Python, since you never want to provide all values. (Filed as bug 460518.)
Comments
Nobody has commented on this entry so far.
Comments for this article have been disabled.