Skip to content

Instantly share code, notes, and snippets.

@sebastianschramm
Created August 23, 2022 14:46
Show Gist options
  • Save sebastianschramm/13a010b88315d961f8f2645fa0fefa88 to your computer and use it in GitHub Desktop.
Save sebastianschramm/13a010b88315d961f8f2645fa0fefa88 to your computer and use it in GitHub Desktop.
Protect your secrets from being accidentally exposed by logging
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