Keyring
Jump to navigation
Jump to search
Keyring can be used to store password so you don't need to put them in your programs hardcoded.
Getting it installed in Ubuntu was quite a hassle. I did:
pip3 install keyring
pip3 install --upgrade keyrings.alt
Not sure if installing the keyring module is needed but I started with that. Then importing keyring was giving errors. Installing keyrings.alt fixed that.
- python3 -m keyring set <service> <username>
- Create in <service> a password-entry for <username>. You will be prompted for the password
- <service> is just to group usernames
- python3 -m keyring get <service> <username>
- Fetch the password for <username> in <service>
import keyring
password = keyring.get_password(service,username)