如何导出JIRA评论

问题描述 投票:0回答:1

我使用Python JIRA库导出项目内容。除注释外,大多数字段都是正常捕获的字段。以下是我的代码,需要帮助指出错误所在。为什么会出现错误:非常感谢。“追踪(最近一次致电过去):comments = item.fields.comment.comments

[AttributeError:类型对象'PropertyHolder'没有属性'comment'“。

dfm=pd.DataFrame()

对于所有发行中的项目:

d={'key':item.key,
'PCB': item.fields.customfield_10424,
'Summary':item.fields.summary,
'Severity': item.fields.customfield_10323,
'Description':item.fields.description,
'Reporter':item.fields.reporter,
'Assignee':item.fields.assignee,
'Create Stage': item.fields.customfield_10324,
'Created Date':item.fields.created[0:10],
'Updated Date':item.fields.updated[0:10],
'Status':item.fields.status,
}
solution=""
comments=item.fields.comment.comments
for comment in comments:  #Get DFM comment filed content
    solution=comment.created[0:10] + " " + str(comment.author.name) + ": " + comment.body
d={'Solution':solution}
python jira jira-plugin python-jira
1个回答
-1
投票
'''
from jira import JIRA
import pandas as pd
import openpyxl
jira=JIRA("http://jira-ep.ecp.priv")
block_size=1000
block_num=0
allissues=[]
while True:
    start_idx=block_num*block_size
    issues=jira.search_issues('project=PRJ0404 and type=DFM',start_idx,block_size)
    if len(issues)==0:
        break
    block_num+=1
    for issue in issues:
        allissues.append(issue)


dfm=pd.DataFrame()
for item in allissues:

    d={'key':item.key,
    'PCB': item.fields.customfield_10424,
    'Summary':item.fields.summary,
    'Severity': item.fields.customfield_10323,
    'Description':item.fields.description,
    'Reporter':item.fields.reporter,
    'Assignee':item.fields.assignee,
    'Create Stage': item.fields.customfield_10324,
    'Created Date':item.fields.created[0:10],
    'Updated Date':item.fields.updated[0:10],
    'Status':item.fields.status,
    }
    solution=""
    comments=item.fields.comment.comments
    for comment in comments:  #Get DFM comment filed content
        solution=comment.created[0:10] + " " + str(comment.author.name) + ": " + comment.body
    d={'Solution':solution}
    dfm =dfm.append(d,ignore_index=True)

'''
© www.soinside.com 2019 - 2024. All rights reserved.