使用 python 从 Jira 获取标签和冲刺值

Get tag and sprint value from Jira using python

能否请您帮助获取特定问题的标签和 Sprint 值

import jira.client
from jira.client import JIRA

options = {'server': 'https://example.com', 'verify':False}
jira = JIRA(options, basic_auth=('user', 'password'))
issues_in_project = jira.search_issues('project=11372 AND SPRINT not in 
closedSprints() AND sprint not in futureSprints()')
for value in issues_in_project:
print value.key , value.fields.summary , value.fields.assignee , 
value.fields.reporter ,value.fields.updated ,value.fields.resolutiondate, 
value.fields.duedate, value.fields.labels,value.fields.tag

运行 python 脚本时,出现错误

DWD-9933 Loading and Validating Products username username 2018-04-02T23:27:07.000-0700 None 2018-04-06 [u'DW-Products'] Traceback (most recent call last): File "jira_test.py", line 23, in print value.key , value.fields.summary , value.fields.assignee , value.fields.reporter ,value.fields.updated ,value.fields.resolutiondate, value.fields.duedate, value.fields.labels,value.fields.tag AttributeError: type object 'PropertyHolder' has no attribute 'tag'

请看一次,帮我实现一下

谢谢,

对于标准属性,使用 getattr built-in 方法和 field 名称(技术上是 id)。 有些字段可以自定义,它们的 id 看起来像这样 customfield_15100。这是获取 JSON 和所有字段信息 https://confluence.atlassian.com/jirakb/how-to-find-id-for-custom-field-s-744522503.html.

的方法

因此,在您的情况下,tag 可能是一个自定义字段。

for value in issues_in_project:

   # standart field
   print(getattr(value.fields(), 'reporter'))
   print(getattr(value.fields(), 'summary'))

   # custom field
   print(getattr(value.fields(), 'customfield_15100'))