Pivotal Tracker的API瘦客户端

pivotal-p的Python项目详细描述


Pivotal Py是一个非常薄的包装器,它构建在HttpLib2之上,用于发出请求 反对Pivotal Tracker API

安装

使用easy_installpip:从pypi安装

pip install pivotal-py

依赖性

关键py需要httplib20.6.0或更高版本。

用法

这个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()

注意:如上所示,有两种方法可以获取请求的内容:

  1. Call ^{tt3}$ to return the content as ElementTree object.
  2. 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)

  • 首次公开发行。

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

推荐PyPI第三方库


热门话题
JavaGWT:何时使用Lazydemelement?   Java中跟踪消失线程的多线程处理   java Springboot未能配置数据源:“url”,但我没有使用数据库   java为按钮生成随机位置   math Java:包含二项式系数计算的表达式   java通过AsyncTask传递参数   从路径错误创建java文件   高流量网站的性能播放框架、Java、Apache、PostgreSQL、JPA和Hibernate   java将4D矢量转换为长矢量   arraylist Java循环在没有任何错误的情况下终止   java正在制作一个计算器应用程序,希望在第二个片段中更新历史,但无法完成   java将信息从IntentService发送到Activity   java如何在游戏中插入大量实体!工作   javascript如何在ScriptEngineforJava中从数学中获得准确的结果?