A simple secrets manager
Project description
A Simple Secrets Manager for python
How to use:
Storing
from SimpleSecretsManager import manager
secrets_manager = manager.SecretsManager("password", "file.bin")
secrets["MY_SECRET"] = "the_secret"
...
secrets_manager.update_secrets(secrets)
secrets_manager.update_secret("ANOTHER_SECRET", "the_other_secret")
secrets_manager.save()
Retrieving
from SimpleSecretsManager import manager
secrets_manager = manager.SecretsManager("password", "file.bin")
try:
my_secret = secrets_manager.get_secret("MY_SECRET")
except SecretsError as e:
print("Issue retrieving 'MY_SECRET': {e}")
By default, it will throw an error SecretsError if the secret does not exist. If you instead pass a default value, you'll be able to get that returned no matter what.
You can also use the secret manager with the 'with' clause so that it auto saves after:
with secrets_manager:
secrets_manager.update_secret("MY_SECRET", "newvalue")
and then upon exiting, newvalue will be saved into "MY_SECRET"
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for SimpleSecretsManager-0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1bfd6d939da00ba58d6d77b64b9c7332bb72734f249212771d1d18ba91b024d3 |
|
MD5 | 5c6e6f438b9a90f8bc9aae0d90d33d13 |
|
BLAKE2b-256 | 9504a91be0a4ab4ad8a7290a939f8ea47b552700270564c4b2d7e41c3850fcab |