python - 如何导出 JIRA 评论
问题描述
我使用 Python JIRA 库来导出项目内容。除了注释之外,大多数字段都是正常的。以下是我的代码,需要帮助指出错误所在。为什么会出现错误:非常感谢。
"Traceback (most recent call last):
comments=item.fields.comment.comments
AttributeError: type object 'PropertyHolder' has no attribute 'comment'".
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)
解决方案
推荐阅读
- bash - 在bash中修剪多行字符串
- python-3.x - 如何在 datetime python 中删除毫秒?
- quarkus - Quarkus 中哪些配置属性在部署时间/运行时不可更改?
- javascript - 为什么它不识别该变量?
- pandas - Pandas 1.0+ 不能 pickle.load 包含带有 MultiIndex 的 DataFrame 的字典
- html - 如何将图片之间的所有空格调整为完全相同
- mongodb - 如何加快大型集合中的 MongoDB 数据类型更改?
- javascript - 定义时返回未定义的变量
- python - 适用于 Azure CosmosDB 的 Gremlin Python SDK
- php - 如何从 \Goutte\Client 获取有效 URL?