0

我的要求是:我想更新过滤器中存在的问题的标签。

import jira.client
    from jira.client import jira

    options = {'server': 'https://URL.com"}
    jira = JIRA(options, basic_auth=('username], 'password'))
    issue = jira.search_issues('jqlquery')
    issue.update(labels=['Test']

我收到属性错误,指出“结果列表”对象没有属性“更新”。

4

2 回答 2

2

更新仅适用于单个问题。Search_issues 返回一个 ResultList。

JIRA API 不支持批量更改。但是,您可以自己遍历问题并为每个问题进行更新。就像是:

import jira.client
from jira.client import jira

options = {'server': 'https://URL.com'}
jira = JIRA(options, basic_auth=('username', 'password'))

issues = jira.search_issues('jqlquery')
for issue in issues:
    issue.update(labels=['Test'])
于 2014-12-03T05:54:21.433 回答
1

它记录在http://jira-python.readthedocs.org/en/latest/的 jira-python 文档中 您可能还必须这样做

问题 = jira.issue(issue.key)

获取可修改的对象

# You can update the entire labels field like this
issue.update(labels=['AAA', 'BBB'])

# Or modify the List of existing labels. The new label is unicode with no spaces
issue.fields.labels.append(u'new_text')
issue.update(fields={"labels": issue.fields.labels})
于 2014-12-03T17:37:27.707 回答