Difference between revisions of "Keyring"
Jump to navigation
Jump to search
(Created page with "Category:Python Category:Security 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...") |
(No difference)
|
Revision as of 17:30, 22 August 2020
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. installinig 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)