用于使用juju charm store API的Python库。
项目描述
用于使用juju charmstore API的Python库。
安装
安装theblues最简单的方法是通过pip
$ pip install theblues
theblues的一些部分需要使用macaroons(例如,解析Charmstore.fetch_macaroon的返回值或与IdentityManager.discharge交互)。
要使用theblues的认证功能,例如JIMM,您需要能够管理macaroons。theblues是在libmacaroons的基础上开发的。在Ubuntu上,您可以从ppa中获取libmacaroons。
$ sudo add-apt-repository ppa:yellow/ppa -y $ apt-get install libmacaroons0 python-macaroons libsodium13
如果没有这些,theblues 无法向 charm store 或其他服务发送任何经过身份验证的请求,但可以用于与 charm store 通信,例如查找 charm 信息。
用法
与 charmstore 交互非常简单。要在 charmstore 中查找实体(例如 charm 或捆绑包)
>>> from theblues.charmstore import CharmStore >>> cs = CharmStore('https://api.jujucharms.com/v4') >>> entity = cs.entity('wordpress') >>> entity['Id'] u'cs:trusty/wordpress-2'
实体的数据包含在响应的 Meta 项中,与 charmstore 返回的 json 匹配
>>> entity['Meta']['charm-metadata']['Name'] u'wordpress'
您还可以获取实体的文件
>>> cs.files('wordpress')['hooks/install'] u'https://api.jujucharms.com/v4/wordpress/archive/hooks/install >>> hook = cs.files('wordpress', filename='hooks/install', read_file=True) >>> print hook #!/bin/bash set -xe ... <snipped for length> ... juju-log "So, environment is setup. We'll wait for some hooks to fire off before we get all crazy"
要查看所有可用方法,请参阅完整文档。
历史
0.5.2 (2019-10-15)
为每个 CS 对象持久化会话
0.5.1 (2019-01-10)
在获取实体信息时,添加定义默认包含项的能力
0.5.0 (2018-10-03)
make_request: 添加包含 macaroons 标头的支持
0.4.1 (2018-09-20)
不再依赖 idm 认证。添加对 macaroons 的支持
0.3.9 (2018-09-18)
使禁用统计收集成为可能。添加钱包和预算。使用 http 烘焙。将 charm-actions 数据添加到 charm_data
0.3.8 (2016-11-23)
在请求释放令牌时,在 idm 查询中正确引用用户名。
0.3.7 (2016-11-03)
支持覆盖默认 URL 以实现向后兼容性。接受 cs: 前缀作为实体 ID
0.3.6 (2016-10-03)
用 JIMM API 替换 JEM API。
0.3.5 (2016-09-30)
为用户返回一个编码的数组。更新 Makefile 以在 clean trusty 机器上工作。开发通道的简单重命名。
0.3.4 (2016-07-28)
统一超时。确保我们没有意外异常。为用户端点添加释放令牌。
0.3.3 (2016-07-04)
添加支持案例创建。
0.3.2 (2016-06-14)
添加对条款和计划的支撑。
0.3.1 (2016-05-10)
在 API 调用中包含所有者。
0.3.0 (2016-05-03)
更新 JEM API 调用到版本 2。
0.2.2 (2016-04-19)
在元搜索和 resource_url 方法中添加资源。
0.2.1 (2016-04-15)
添加了身份管理器和 juju 环境管理器 API 的代码
更新文档
0.2.0 (2016-03-24)
添加 LGPL3 许可证。
添加可选通道参数。
减少依赖性限制,以在 trusty -> xenial 之间工作。
0.1.1 (2016-01-25)
使用 jujubundlelib 中的 Reference 作为参数。
添加列表端点。
0.1.0 (2015-12-04)
修复空 macaroon 饼干的问题。
0.0.5 (2015-11-20)
公开 common-info。
修复导入。
0.0.4 (2015-06-10)
支持设置 charmstore 请求的超时。
0.0.3 (2015-05-04)
将类型过滤器添加到 charmstore 搜索。
0.0.2 (2015-04-08)
将系列过滤器添加到 charmstore 搜索。
将 charmstore 的 407 http 错误处理为 EntityNotFound。
将简单的用法示例添加到 README 中。
HACKING 中进行了一些小的更改。
进行了一些小的修复。
0.0.1 (2015-03-19)
初始发布。
项目详情
theblues-0.5.2.tar.gz 的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | a9aded6b151c67d83eb9adcbcb38640872d9f29db985053259afd2fc012e5ed9 |
|
MD5 | 509b2294a952e13f241a7d82b63d7730 |
|
BLAKE2b-256 | 9e4409471b2abf1cc22a427a8d49e4cfa9049bc18ea2c99d318faffc37b367a3 |