How do you Configure Python Keyring to pull credentials from Windows Credential Manager on Windows 7?

Brian J picture Brian J · Jun 20, 2017 · Viewed 13.3k times · Source

I've spent a lot of time researching the keyring package trying to get a simple example to work. I'm using python 2.7 on a windows 7-x64 machine. I've installed the package and confirmed that the files are within my Lib/site-packages folder.

In this code snippet from the installation docs what is supposed to go in "system"?

import keyring
keyring.get_password("system", "username")

When I run the code i get the following error:

RuntimeError: No recommended backend was available. Install the keyrings.alt package if you want to use the non-recommended backends.

It seems like it's not recognizing Windows as the backend. I feel like I'm missing a simple step. Any help is appreciated including a simple code example of pulling generic credentials from Windows Credential Manager.

Answer

Brian J picture Brian J · Dec 12, 2017

Finally got this working. The information from Shaun pointed me in the right direction with installing pywin32. From there I did trial and error with creating test credentials in Windows Credential Manager and testing the Python keyring function.

I only got it working with Generic Credentials which is fine for my purposes. I set Internet or network address to "test". Username was set to "test_user". Password was set to "test123". (Quotes included here for instruction, don't include when entering them.

print keyring.get_password("test","test_user") 

returned the result "test123"

Hopefully this information helps somebody else. Thanks to Shaun for the direction needed to solve this.