用于释放功能切换系统的python客户端!

UnleashClient的Python项目详细描述


释放客户端python

CircleCICoverage StatusPyPI versionPyPI - Python VersionLicense: MIT

这是Unleash的python客户端。它实现Client Specifications 1.0,并根据unleash/client-specifications中的规范检查遵从性

它支持的功能:

  • 使用32位Murmerhash3的默认激活策略
  • 自定义策略
  • 完整的客户端生命周期:
    • 客户端向释放服务器注册
    • 客户端定期获取功能切换并存储到磁盘缓存
    • 客户端定期发送度量以释放服务器

查看project documentationchangelog

安装

查看Pypi上的包!

pip install UnleashClient

用法

初始化

from UnleashClient import UnleashClient
client = UnleashClient("https://unleash.herokuapp.com/api", "My Program")
client.initialize_client()

优雅地清理:

client.destroy()

参数

ArgumentDescriptionRequired?TypeDefault Value
urlUnleash server URLYStringN/A
app_nameName of your programYStringN/A
environmentName of current environmentNStringdefault
instance_idUnique ID for your programNStringunleash-client-python
refresh_intervalHow often the unleash client should check for configuration changes.NInteger15
metrics_intervalHow often the unleash client should send metrics to server.NInteger60
disable_metricsDisables sending metrics to Unleash server.NBooleanF
disable_registrationDisables registration with Unleash server.NBooleanF
custom_headersCustom headers to send to Unleash.NDictionary{}
custom_strategiesCustom strategies you'd like UnleashClient to support.NDictionary{}

检查功能是否已启用

检查一个简单的开关:

client.is_enabled("My Toggle")

指定默认值:

client.is_enabled("My Toggle", default_value=True)

提供应用程序上下文:

app_context = {"userId": "test@email.com"}
client.is_enabled("User ID Toggle", app_context)

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java是否在servlet中检索上一页路径?   Java抱怨在开关的默认情况下未初始化最终字段   Java泛型:为什么编译器不能判断这个类<t>对象与这个类的类型参数的对象的类具有相同的类型?   Java:继承方法中使用的私有变量   HibernateJava。ClassCastException:java。lang.Integer不能强制转换为abc。def。我的项目。奥姆。EmployeeTopMetaData   http java发布和下载文件   java改进条件检查   java如何将2d数组的条目作为键放在地图中   java如何获取传递给运行时的值。getRuntime。JUnit测试用例中的exit(value)   java注释来创建所有可能的构造函数   自动建议列表:java。lang.IllegalArgumentException:在XPath表达式为null时找不到元素   为什么MapAPI在Java中不提供流功能?   gradle不导入本地java库   尽管我使用的是SessionCreationPolicy,java Spring安全性似乎仍在使用会话。无国籍   使用java查找MongoDB中数组元素的平均值