Skip to content
Advertisement

How do I retrieve a username with Python keyring?

I have a Mercurial keyring on my Windows 7 machine. I am using the Python keyring library to get user credentials from the Mercurial keyring.

I can retrieve the password for a given username with:

keyring.get_password('Mercurial', 'user@@etc')

Is there a similar function to retrieve the username?

Advertisement

Answer

You are expected to have stored the username somewhere else.

The keyring only stores the password, keyed by the application name and username.

Advertisement