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

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


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.


You may have to install the pywin32 package. Doing so solved the problem for me.

Using conda:
conda install -e environment_name_here pywin32

Using pip:
pip install pywin32

On a tangent: For some reason, the code swallows an exception that the windows credential manager class would have otherwise thrown to alert you to this problem. Here's the exception and here's where it's caught and thrown away.


i don't know if you can do that but instead you can ask the user to give it's credentials using this following commands

import adminif not admin.isUserAdmin():    admin.runAsAdmin()