Advertisement
Stevoisiak

Store password with python keyring

Feb 16th, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.44 KB | None | 0 0
  1. import keyring
  2.  
  3. # check "remember me" checkbox by default
  4.  
  5.  
  6. def __init__(self):
  7.     # ... UI stuff
  8.    
  9.  
  10.  
  11. def logon_clicked(self):
  12.     username = "username"
  13.     password = "password"
  14.  
  15.     if remember_me_checkbox.ischecked:
  16.         # TODO: See how windows names keyring entries
  17.         keyring.set_password("kronos_wfc", username, password)
  18.     else:
  19.         if keyring.get_password("kronos_wfc", username) is not None:
  20.             keyring.delete_password("kronos_wfc", username)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement