Python Decouple的AWS扩展
项目描述
Python Decouple AWS 帮助您组织并访问AWS Secrets Manager中的敏感信息。
它还使您能够
不重复boto3样板代码;
定义默认值;
使用os.environ作为后备;
支持Python 3.4+;
为什么
单处保存所有秘密(AWS Secrets Manager);
将敏感信息与代码和环境隔离开来;
使用更简单的API访问AWS Secrets Manager(而不是boto3);
安装
pip install python-decouple-aws
使用示例1
# settings.py
from decouple_aws import get_config
# The package provides a wrapper function that will
# fallback to environment variables and fail gracefully
# if AWS Secrets Manager is not accessible for whatever
# reason.
config = get_config('your-project/secret/name', 'ap-southeast-2')
# Use decouple config like normal
MY_EMAIL_USER = config('MY_EMAIL_USER', 'default-user')
MY_EMAIL_PASS = config('MY_EMAIL_PASS')
使用示例2
# settings.py
from decouple import Config
from decouple_aws import RepositoryAwsSecretManager
# if you would like it to fail if secrets
# manager is inaccessible, you can build it manually.
# initialise the config with the AWS repository
# Pass the repo your secret name and the region
repo = RepositoryAwsSecretManager('your-project/secret/name', 'ap-southeast-2')
config = Config(repo)
# Use decouple config like normal
MY_SUPER_SECRET_SETTING = config('MY_SUPER_SECRET_SETTING')
项目详情
关闭
python-decouple-aws-0.3.2.tar.gz 的哈希值
| 算法 | 哈希摘要 | |
|---|---|---|
| SHA256 | ae374302259b3f9825287e0962a9c4ab4578ec572bc126595250401b9fc6606f |
|
| MD5 | c67ffd980dcaed65398b4446d0b0874f |
|
| BLAKE2b-256 | 2500d5cc5aaa10c40bfcf4fd8c90f3e96016b078ce8bd4ba8a0d5e7a8746810d |
关闭
python_decouple_aws-0.3.2-py3-none-any.whl 的哈希值
| 算法 | 哈希摘要 | |
|---|---|---|
| SHA256 | 58ee5b5b037aa13db0905d9f524ffc8c403fb0721f2c707b2c9d048a5b1d1c61 |
|
| MD5 | 08abe329346b12c0f0c304b1709beccd |
|
| BLAKE2b-256 | 06c1cae32018e2ec727a86556216b1bda602c5a43376a71e21b1e4bfd44bee22 |