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"
Provided under MIT License
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
File details
Details for the file simplesecretsmanager-0.3.tar.gz
.
File metadata
- Download URL: simplesecretsmanager-0.3.tar.gz
- Upload date:
- Size: 3.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.5.1 CPython/3.10.12 Linux/6.2.0-26-generic
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c59d696d0683b27d78d59ea918d83ced5c018fabbc9d108098c25a49c4115c49 |
|
MD5 | 70f79023548ce76f39f7862c5a61bc8a |
|
BLAKE2b-256 | 3b6c7c65a9356fd6b81bc4b11401a23387a0274693d68ccc39f61f6dea53ea17 |
Provenance
File details
Details for the file simplesecretsmanager-0.3-py3-none-any.whl
.
File metadata
- Download URL: simplesecretsmanager-0.3-py3-none-any.whl
- Upload date:
- Size: 4.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.5.1 CPython/3.10.12 Linux/6.2.0-26-generic
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 118e610e45dc8bf961f32e2002fb7a64496e5d5cfb6793140ecac460c3f8dd2a |
|
MD5 | a1a1f04f3dbe5e3d55674b6bb47aba8b |
|
BLAKE2b-256 | 914c6b66536eefff4ff13601a47db132c548de7022582c1e0a20c46f0452f8b4 |