Introduction
secretfunctions is a simple library to have a common interface for requesting secret elements like passwords etc. we used python-decouple module but and it works fine in the beginning but after a while when using more and more modules it was not clear which file decouple really is using for loading the secrets. In the end we couldn't figure out when a file was used and how. So before investing too much time, we decided to write this simple wrapper over a dotenv file and make a query function.
The class SecretFunction has a singleton and in the constructor the file "~/.env" is loaded. With the function get_secret_key() you can query the values and receive either the value itself or a default, which is None by default.
Getting Started
The module has one class SecretFunction with one method get_secret
Installing
pip install secretfunction
Usage
SecretFunctions
import secretfunctions
secret_handler = secretfunctions.SecretFunctions()
print(secret_handler.get_secret_key("EOD2PD_API_KEY"))
if your ~/.env file exists and you have a key "EOD2PD_API_KEY in there, you receive the value of the key, otherwise you receive None.
That simple.
Project Homepage
https://dev.azure.com/neuraldevelopment/secretfunctions
Contribute
If you find a defect or suggest a new function, please send an eMail to neutro2@outlook.de
Metadata
Release files for secretfunctions 0.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| secretfunctions-0.0.2.tar.gz | 4.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| secretfunctions-0.0.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 8.3 kB
Release files / secretfunctions-0.0.2.tar.gz
| Download URL | secretfunctions-0.0.2.tar.gz |
|---|---|
| Size | 4.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7e8d8499154b5d46c2b359d7001ea2fd51ca236fa9bbad0e31ae619c512c8790
|
|
BLAKE2b-256 checksum How to use checksums |
d3c8e849dc7bc64ff60e9d83eb4ee627428a72628273dc4ce3a9f87de22f91b5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.10.14
|
Release files / secretfunctions-0.0.2-py3-none-any.whl
| Download URL | secretfunctions-0.0.2-py3-none-any.whl |
|---|---|
| Size | 4.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e3c0cc0284f3510f9c108a9c9257c7835f1eaf4f77debdb3396552d08eb042f4
|
|
BLAKE2b-256 checksum How to use checksums |
2c41b01b52e910db68e1f5f3f9209e21e281d851694e064b7c681ae16618c6ee
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.10.14
|