Keyring: Secure Password Storage
Keyring is a Python library that provides an easy way to access the system's keyring service, allowing applications to store and retrieve passwords securely. The current version is 25.7.0, released on September 20, 2023. Keyring follows a regular release cadence, with updates addressing compatibility, security, and functionality improvements.
Warnings
- gotcha On macOS, importing keyring may produce dbus-related warnings if dbus is not properly configured.
- breaking Upgrading Python versions may cause compatibility issues with Keyring if the backend dependencies are not updated accordingly.
Install
-
pip install keyring
Imports
- keyring
import keyring
Quickstart
import keyring
# Set a password
keyring.set_password('system', 'username', 'password')
# Retrieve a password
retrieved_password = keyring.get_password('system', 'username')
print(retrieved_password)