提示:文章写完后,目录可以自动生成,如何生成可参考右边的帮助文档
最近有导bug需要,准备用request去获取jira数据库的数据,百度发现竟然还有jira库这种玩意,调试了一下,特此记录初步用法
代码如下(示例):
from jira import JIRA
from jira.resources import IssueType, Attachment
jira = JIRA(server='https://jira.xxxx.com.cn/', basic_auth=('xxxxx', 'xxxxx'))
data = jira.search_issues('project=B111', maxResults=-1)
for d in data:
if d.key == 'B111-276':
print('https://jira.xxxx.com.cn/projects/B111/issues/' + d.key) # 缺陷地址
print("summary:", d.fields.summary) # 缺陷题目
print('assignee:', d.fields.assignee) # 缺陷经办人
print('status:', d.fields.status) # 缺陷状态
print('issuetype:', d.fields.issuetype) # 类型
print('reporter:', d.fields.reporter) # 关联者
print("labels:", d.fields.labels) # 标签
print("name:", d.fields.priority.name) # 缺陷等级
print('description:', d.fields.description) # 缺陷描述
print("created", d.fields.created) # 创建时间
print("versions", d.fields.versions) # 缺陷版本
print("fixVersions:", d.fields.fixVersions) # 修复版本
print(d.fields.attachment) # 附件信息
for m in d.fields.attachment: # 获取所有附件并下载
data = m.get()
with open(str(m), 'wb+') as file:
file.write(data)
print('--------------------------------------------------------------------------------')
for key, value in d.raw['fields'].items(): # 获取issue的所有字段
if value is not None:
print(key)
print(value)
break
我是一名车载集成测试开发工程师,希望能和志同道合的朋友一起相互学习进步