Files
Place-Order-Trading-Bot/login2keyring.ipynb
T

3.5 KiB
Raw Blame History

Import Libaries

In [1]:
import keyring as kr

Save Pwd to keyring

  • servicename The name of the service i.e to a certain organization with which the person is related to.
  • username Username of the person.
  • password Password associated with that username.
kr.set_password("servicename","username","pwd")
In [3]:
login = 10730196
password = '#mDJu9O3'
server = 'VantageInternational-Demo'
In [9]:
kr.set_password(server, str(login), password)

Get Password

To retrieve the saved password we will use the get_password() method. It takes two parameters.

  • Servicename
  • Username
print(kr.get_password("Servicename","Username"))
In [5]:
print(kr.get_password(server,str(login)))
#mDJu9O3

Retrievieng Credentials

In [10]:
cred = kr.get_credential(server,"") 
  
print("Username : ",cred.username) 
print("Password : ",cred.password)
Username :  10730196
Password :  #mDJu9O3

Delete from Keyring

To delete a password we will use the delete_password() method. It also takes two parameters:

  • Servicename
  • Username
kr.delete_password("Servicename", "Username") 
In [ ]:
kr.delete_password(server, str(login)) 
In [7]:
print(kr.get_password(server, str(login)))
None
In [ ]: