ezconfig client
Project description
EZConfig 客户端程序
使用方法
pip install ezconfig-client
传入自定义参数,获取最新配置
from ezconfig_client import loader
res = loader.get_latest_config_by_params("DEV", "app_id", "secret", [
"https://xxxx-1.xxx.xxx",
"https://xxxx-2.xxx.xxx",
])
print(res)
从环境变量中获取参数,从而获取配置的方法
from ezconfig_client import loader
res = loader.get_latest_config()
print(res)
使用前需要设置环境变量
| 环境变量 | 说明 |
|---|---|
| EZCONFIG_ENV | 环境变量 |
| EZCONFIG_APPID | 应用ID |
| EZCONFIG_SECRET | 应用密钥 |
| EZCONFIG_HOST | EZConfig服务地址,支持单个地址、逗号分隔的多个地址或JSON数组字符串 |
环境依赖:
requests>=2.22.0
retrying>=1.3.4
测试参考代码
EZCONFIG_ENV=DEV EZCONFIG_APPID=xxx.xx.xxx EZCONFIG_SECRET=xxxxxxx EZCONFIG_HOST=https://xxxx-1.xx,https://xxxx-2.xx python test/test.py
版本说明
| 版本 | 变更 |
|---|---|
| 0.4 | 降低requests版本,修改bug |
| 0.5 | 增加访问错误重试机制,请求超时30秒,失败重试3次 |
| 0.6 | 新增get_latest_config_by_params方法,传自定义参数获取最新配置,而不是走环境变量获取参数 |
| 0.7 | 去掉库里面的打印信息 |
| 0.8 | 增加多主机配置解析 |
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
ezconfig_client-0.8.tar.gz
(5.2 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ezconfig_client-0.8.tar.gz.
File metadata
- Download URL: ezconfig_client-0.8.tar.gz
- Upload date:
- Size: 5.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6ae3403c7f8fd6652e5e2103c515ad7f34917becce30e1ae3cce43c1f43327cf
|
|
| MD5 |
1e31f35ed3a174f1491b0633a4973b98
|
|
| BLAKE2b-256 |
00acb17555ee6bcf2c996d2213a95190e9e3685f0977ff15cebd94f7251c8eb4
|
File details
Details for the file ezconfig_client-0.8-py3-none-any.whl.
File metadata
- Download URL: ezconfig_client-0.8-py3-none-any.whl
- Upload date:
- Size: 5.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0455d95989a7688575b05dbdb61326e2e7ba3abd92fdcac862171c4c96243900
|
|
| MD5 |
cc4002ff1ee3d97a58d5c6098e5ecaff
|
|
| BLAKE2b-256 |
336dfbd019e74bcdebd743dbef5363b75683084764a31524a861ecd68455f673
|