module hackathon.crypt_helper
#
Short summary#
module ensae_projects.hackathon.crypt_helper
Encrypting, decrypting.
Functions#
function |
truncated documentation |
---|---|
Returns a default username. |
|
Retrieves a password assocatied to key. Relies on module keyring. |
|
Stores a password assocatied to key. Relies on module keyring. |
Documentation#
Encrypting, decrypting.
- ensae_projects.hackathon.crypt_helper._default_name()#
Returns a default username.
os.environ.get('USERNAME', os.environ.get('NAME', 'unknown'))
- ensae_projects.hackathon.crypt_helper.get_password(key, username=None)#
Retrieves a password assocatied to key. Relies on module keyring.
- Parameters:
key – key
username – username or
environ['USERNAME']
if None
- Returns:
password
Store and retrieve a password
Module keyring can be used to store and retrieve a password. It is an easy way to avoid letting clear password in the code. To store a password:
<<<
from pyquickhelper.loghelper import set_password set_password("system", "username", "password")
>>>
And to retrieve it:
<<<
from pyquickhelper.loghelper import get_password pwd = get_password("system", "username") print(pwd)
>>>
password