子弹头列车python sdk
bullet-train的Python项目详细描述
子弹头列车客户机
pythonhttps://bullet-train.io/的sdk客户端。Bullet Train允许您跨多个项目、环境和组织管理功能标志和远程配置。
开始
这些说明将为您在本地计算机上启动和运行项目的副本,以便进行开发和测试。有关如何在实时系统上部署项目的说明,请参阅在生产环境中运行。
安装
通过PIP
pip install bullet-train
用法
检索项目的功能标志
有关完整文档,请访问https://docs.bullet-train.io
frombullet_trainimportBulletTrain;bt=BulletTrain(environment_id="<YOUR_ENVIRONMENT_KEY>")ifbt.has_feature("header",'<My User Id>'):ifbt.feature_enabled("header"):# Show my awesome cool new feature to the worldifbt.has_feature("header"):ifbt.feature_enabled("header"):# Show my awesome cool new feature to the worldvalue=bt.get_value("header",'<My User Id>')value=bt.get_value("header")
可用选项
Property | Description | Required | Default Value |
---|---|---|---|
^{ | Defines which project environment you wish to get flags for. example ACME Project - Staging. | YES | None |
^{ | Use this property to define where you're getting feature flags from, e.g. if you're self hosting. | NO | https://api.bullet-train.io/api/ |
可用函数
Function | Description |
---|---|
^{ | Get the value of a particular feature e.g. ^{ |
^{ | Get the value of a particular feature for a user e.g. ^{ |
^{ | Get the value of a particular feature e.g. ^{ |
^{ | Get the value of a particular feature for a specified user e.g. ^{ |
^{ | Trigger a manual fetch of the environment features, returns a list of flag objects, see below for returned data |
^{ | Trigger a manual fetch of the environment features with a given user id, returns a list of flag objects, see below for returned data |
识别用户
识别用户允许您从Bullet Train dashboard中针对特定用户。
可以在has_feature
和get_value
方法中包含可选的用户标识符,以检索唯一的用户标志和变量。
flags数据结构
Field | Description | Type |
---|---|---|
id | Internal id of feature state | Integer |
enabled | Whether feature is enabled or not | Boolean |
environment | Internal ID of environment | Integer |
feature_state_value | Value of the feature | Any - determined based on data input on bullet-train.io. |
feature | Feature object - see below for details | Object |
功能数据结构
Field | Description | Type |
---|---|---|
id | Internal id of feature | Integer |
name | Name of the feature (sometimes referred to as key or ID) | String |
description | Description of the feature | String |
type | Feature Type. Can be FLAG or CONFIG | String |
created_date | Date feature was created | Datetime |
inital_value | The initial / default value set for all feature states on creation | String |
project | Internal ID of the associated project | Integer |
贡献
请阅读CONTRIBUTING.md了解我们行为准则的详细信息,以及向我们提交请求的过程。
获取帮助
如果您遇到一个bug或特性请求,我们希望听到它。在提交问题之前,请搜索现有的问题,以防止重复。
联系
如果您对我们的项目有任何疑问,可以通过电子邮件projects@solidstategroup.com。