New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Serialize model with SecretStr #919
Labels
Comments
Please complete the opening questions of an issue. They are there for a
good reason.
What version of pydantic are you using?
…On Mon, Oct 21, 2019, 18:14 Ashton Shears ***@***.***> wrote:
Question
I would like to call .dict() method on a model with a secret str type.
The use case is that I want to log this model with the secret still
hidden, but need to send the payload with it as the true string.
Currently, I get: TypeError: Object of type SecretStr is not JSON
serializable
Is there a function that can be called on a model with SecretStr type that
will turn it into a dictionary with the Secrets visible?
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#919>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AA62GGKTO2VT23WNTDYW4UTQPXOXRANCNFSM4JDBJA4Q>
.
|
Apologies for not including, added to the orginal post |
After reading this thread: #133, I realize the way I was intending to use it was incorrect and the thread had examples to solve my use case. Closing this issue. |
alexdrydew
pushed a commit
to alexdrydew/pydantic
that referenced
this issue
Dec 23, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Question
I would like to call .dict() method on a model with a secret str type.
The use case is that I want to log this model with the secret still hidden, but need to send the payload with it as the true string.
Currently, I get: TypeError: Object of type SecretStr is not JSON serializable
Is there a function that can be called on a model with SecretStr type that will turn it into a dictionary with the Secrets visible?
Environment:
pydantic: 0.32.2
OS: macOS
python: 3.7.0
The text was updated successfully, but these errors were encountered: