Created
August 23, 2022 14:46
-
-
Save sebastianschramm/13a010b88315d961f8f2645fa0fefa88 to your computer and use it in GitHub Desktop.
Protect your secrets from being accidentally exposed by logging
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pydantic import SecretStr | |
# NOTE: it is usually not a good idea to hard-code your passwords, | |
# this is just for illustration purposes | |
my_password = SecretStr("adminAdmin123") | |
""" | |
>>> str(my_password) | |
'**********' | |
>>> print(my_password) | |
********** | |
>>> my_password.get_secret_value() | |
'adminAdmin123' | |
""" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment