python apollo client
Project description
携程 Apollo(阿波罗) 配置客户端
说明
这是一个携程 Apollo(阿波罗) 配置客户端。
链接
安装
pip install py-apollo-client
依赖
pip install requests
使用
环境变量获取客户端:
import os
from ApolloClient import ApolloClient
os.environ.setdefault('ENV_PREFIX_APOLLO', 'apollo')
os.environ.setdefault('APOLLO_URI', 'http://192.168.68.251:8080')
os.environ.setdefault('APOLLO_APPID', 'equipment-services')
client = ApolloClient.env()
拉取配置:
print(client.pull())
获取配置(缓存):
print(client.get('debug'))
获取配置:
print(client.get('debug', cache=False))
属性
属性 | 默认值 | 说明 |
---|---|---|
uri | None | 服务地址 |
appid | None | 应用编号 |
ip | None | 客户端地址,为 True 则自动获取 |
cluster | default | 集群别名 |
namespace | application | 空间别名 |
release | None | 最后版本 |
last | 0 | 最后获取配置时间戳 |
rate | 5 | 速率限制,几秒内只请求一次接口 |
setting | {} | 获取到的配置 |
Project details
Release history Release notifications | RSS feed
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 py-apollo-client-0.0.2.tar.gz
.
File metadata
- Download URL: py-apollo-client-0.0.2.tar.gz
- Upload date:
- Size: 3.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.1 CPython/3.9.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5d2a2540a80d7ecfd889f082acc083b69f81ad741437eec3749a9053f3bdd353 |
|
MD5 | 846fca395a2e010cf0f4bce40aa0c30e |
|
BLAKE2b-256 | ade6aec8870f129399bf444a177e2bed84bc711c9626b0a5271674062478613a |
File details
Details for the file py_apollo_client-0.0.2-py3-none-any.whl
.
File metadata
- Download URL: py_apollo_client-0.0.2-py3-none-any.whl
- Upload date:
- Size: 3.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.1 CPython/3.9.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e0ee3f0caa6569973791e468b4f44f2b34bec9d950ac6a54f7506cf2e64ab8f9 |
|
MD5 | 074cc75578fc896984b1e7dc8b2fcccb |
|
BLAKE2b-256 | a1faea88f1fae19d2f6ce15a04755f52d87785c9fc9b5b45d9cc8262d4656a9f |