Pivotal Tracker的API瘦客户端
pivotal-p的Python项目详细描述
Pivotal Py是一个非常薄的包装器,它构建在HttpLib2之上,用于发出请求 反对Pivotal Tracker API。
用法
这个pivotal tracker api客户端使用令牌来验证pivotal 追踪器。您可以通过转到用户配置文件并创建一个api来获取令牌 代币。
一旦有了api令牌,对api发出请求就遵循一个简单的 可链接方法的模式,例如:
from pivotal import Pivotal pv = Pivotal('TOKEN') # Assuming a base URL of 'http://www.pivotaltracker.com/services/v3/' # Perform a GET at /projects and processes content via ElementTree. etree = pv.projects().get_etree() # Perform the same GET at /projects but return the response and # content direct from httplib2. response, content = pv.projects().get()
注意:如上所示,有两种方法可以获取请求的内容:
- Call ^{tt3}$ to return the content as ElementTree object.
- Call ^{tt4}$ to return the tuple containing both the response and content direct from httplib2.
任何位置参数都被推送到url:
# Perform a GET at /projects/[id]/stories where [id] is a project ID. etree = pv.projects(id).stories().get_etree()
任何关键字参数都映射到url查询字符串并附加在 URL结尾:
# Perform a GET at /projects/[id]/stories and filter stories by those that # are not started. etree = pv.projects(id).stories(filter='state:unstarted').get_etree() # Results in a URL of: /projects/[id]/stories?filter=state%3Aunstarted
注:员额目前尚未执行,但计划是执行 post方法,它接受一个作为post主体的body参数:
# TODO: POST to /projects to create a new project etree = pv.projects().post(xml_body)
更改
0.1.3(2011-07-08)
- 从导致httplib2的初始化py中删除了关键导入 问题。
0.1.2(2011-07-08)
- 添加了httplib2作为依赖项。
0.1.1(2010-12-10)
- 添加了一个examples文件夹,其中有一个显示要发送的脚本的示例 一封电子邮件,向多个团队成员总结跨项目的故事。
- 提供get()和get_etree()。get()方法 直接从httplib2返回请求的响应和内容。 get_etree()将返回内容的ElementTree对象。
0.1.0(2010-10-15)
- 首次公开发行。