config.py 文件源码

python
阅读 31 收藏 0 点赞 0 评论 0

项目:MusicBot 作者: BjoernPetersen 项目源码 文件源码
def request_secret(secret_key, message, hidden=True):
    """
    Request a secret from the user. Save the secrets to disk afterwards.
    If there is already a secret for the key, return it.
    :param secret_key: the key the input should be stored under in the secrets
    :param message: the message to show to the user
    :param hidden: hide the input (recommended for passwords and such)
    :return the secret
    """
    if secret_key in _secrets:
        return _secrets[secret_key]

    if hidden:
        secret = getpass(message).strip()
    else:
        secret = input(message).strip()

    _secrets[secret_key] = secret
    save_secrets()

    return secret
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号