且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

获取问题注释JIRA python

更新时间:2022-02-06 21:14:47

必须通过设置相应的参数来手动声明必须包含的字段,否则search_issues方法不会返回注释字段.

The comment field is not returned by the search_issues method you have to manually state the fields that must be included by setting the corresponding parameter.

只需在search_issue方法中包含"fields"和"json_result"参数,并以此进行设置

just include the 'fields' and 'json_result' parameter in the search_issue method and set it like this

open_issues = jira_object.search_issues('project = Support AND issuetype = Incident AND \
    (status = "Open" OR status = "Resolved" OR status = "Waiting For Customer")', maxResults = 100,expand='changelog',fields = 'comment',json_result ='True')

现在您可以访问注释而不会出现密钥类型错误

Now you can access the comments without getting keytype error

comm=([issue.raw['fields']['comment']['comments'] for issue in open_issues])