Difference between revisions of "Keyring"

From wiki
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...")
 
m
 
Line 11: Line 11:
 
</syntaxhighlight>
 
</syntaxhighlight>
  
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.
+
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>
 
;python3 -m keyring set <service> <username>

Latest revision as of 11:59, 18 June 2021


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)