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
py-apollo-client-0.0.2.tar.gz
(3.5 kB
view hashes)
Built Distribution
Close
Hashes for py_apollo_client-0.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e0ee3f0caa6569973791e468b4f44f2b34bec9d950ac6a54f7506cf2e64ab8f9 |
|
MD5 | 074cc75578fc896984b1e7dc8b2fcccb |
|
BLAKE2b-256 | a1faea88f1fae19d2f6ce15a04755f52d87785c9fc9b5b45d9cc8262d4656a9f |