secrets

Functions for working with secrets, such as API tokens.

New in version 0.4.6.

Classes:

Secret(value)

Subclass of str that guards against accidentally printing a secret to the terminal.

class Secret(value)[source]

Bases: str

Subclass of str that guards against accidentally printing a secret to the terminal.

The actual value of the secret is accessed via the .value attribute.

The protection should be maintained even when the secret is in a list, tuple, set or dict, but you should still refrain from printing objects containing the secret.

The secret overrides the __eq__() method of str, so:

>>> Secret("Barry as FLUFL") == "Barry as FLUFL"
True

New in version 0.4.6.

Methods:

__eq__(other)

Return self == other.

Attributes:

value

The actual value of the secret.

__eq__(other)[source]

Return self == other.

Return type

bool

value

Type:    str

The actual value of the secret.