SeatGeek的六袋A/B测试框架的Python客户端,六袋正在SeatGeek积极开发中
项目描述
SeatGeak的Sixpack A/B测试框架的Python客户端库。
安装
首先在虚拟环境中安装
$ pip install sixpack-client
用法
基本示例
from sixpack.sixpack import Session session = Session() # Participate in a test (creates the test if necessary) session.participate("new-test", ["alternative-1", "alternative-2"]) # Convert session.convert("new-test")
每个会话都与一个必须跨请求保留的 client_id 相关联。下面是第一个请求可能的样子
session = Session() resp = session.participate("new-test", ["alternative-1", "alternative-2"]) set_cookie_in_your_web_framework("sixpack-id", session.client_id)
然后您可以根据resp[‘alternative’][‘name’]在您的应用程序中做出决策
session = Session() resp = session.participate("new-test", ["alt-1", "alt-2"]) if resp["alternative"]["name"] == "alt-1": set_variable_in_view("new-test-alternative", "alt-1")
对于未来的请求,请使用存储在cookie中的 client_id 创建 Session
client_id = get_cookie_from_web_framework("sixpack-id") session = Session(client_id=client_id) session.convert("new-test")
会话可以接受一个可选的 options 字典,该字典以 host 和 timeout 作为键。这允许您自定义六袋的位置。
options = {'host': 'http://mysixpacklocation.com'} session = Session(client_id="123", options=options)
如果六袋不可达或其他错误发生,sixpack-py将提供控制替代方案。
贡献
叉它
创建您的功能分支(git checkout -b my-new-feature)
提交您的更改(git commit -am ‘添加了一些功能’)
推送到分支(git push origin my-new-feature)
创建新的拉取请求
项目详情
关闭
Sixpack-client-1.2.0.tar.gz的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | bd0bb616af15dea5324c39486bae1b66a6a3a7f269b874f5283449a2e23e219f |
|
MD5 | 874cf5158864343e3823a1752ee24482 |
|
BLAKE2b-256 | a868a50c79ee93da1d9122fb97671664176ca20b9ef1c3e47a1860b316e14034 |