Python SDK for Zentao.
Project description
pyzentao 是禅道API的Python SDK,简单封装了禅道API,将其映射成为Python方法,例如:
GET /zentao/user-task-[userID]-[type]-[recTotal]-[recPerPage]-[pageID].json
被映射成为 Zentao.user_task(...) ,后续 [...] 里的参数被映射成为调用方法的参数。
在调用方法时,pyzentao 会根据初始化时输入的配置参数获取禅道的授权,然后调用对应的API,并返回原生的数据结果。
Installation
$ pip install -U pyzentao
Usage
举个栗子,要获取指定用户的任务,原生API为:
GET /zentao/user-task-[userID]-[type]-[recTotal]-[recPerPage]-[pageID].json
该API被映射为 user_task 方法:
import pyzentao
zentao = pyzentao.Zentao(
"url": "http://my.zentao.site/namespace",
"version": "15",
"username": "admin",
"password": "123456",
)
tasks = zentao.user_task(
userID=1,
type="finishedBy",
...
)
print(tasks.status) # success
print(tasks.data) # dict...
初始化 Zentao 对象时的参数说明如下:
url: 禅道站点的域名
version: 禅道版本号,不同的禅道版本其API格式不同
username: 登录禅道的帐号用户名,该帐号最好具有管理员权限
password: 登录禅道的帐号密码
spec: 自定义的API规则,选填
path: 存放自定义规则的路径或者文件路径,须为yaml文件
merge: 合并方式,True 表示与默认规则合并
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pyzentao-0.2.1.tar.gz
(31.1 kB
view hashes)