def store_password(params, password):
"""Store the password for a database connection using :mod:`keyring`
Use the ``user`` field as the user name and ``<host>:<driver>`` as service name.
Args:
params (dict): database configuration, as defined in :mod:`ozelot.config`
password (str): password to store
"""
user_name = params['user']
service_name = params['host'] + ':' + params['driver']
keyring.set_password(service_name=service_name,
username=user_name,
password=password)
评论列表
文章目录