Jira Python在问题链接上出现Keyerror



我有一个脚本,它通过Jira API获取信息,然后进行一些比较,但我得到了以下错误:

错误:"errorMessage":"向外发布"errorType":"KeyError">

JSON格式:

"issuelink":[

{
"id": "1255",
"self": "https://jiraurl/rest/api/2/issueLink/0000",
"type": {
"id": "10030",
"name": "Arises ",
"inward": "gives rise to",
"outward": "arises from",
"self": "https://jiraurl/rest/api/2/issueLinkType/0000"
},
"outwardIssue": {
"id": "1251575",
"key": "temp-511",
"self": "https://jiraurl/rest/api/2/issue/0000",
"fields": {
"summary": "a summary",
"status": {
"self": "https://jiraurl/rest/api/2/status/6",
"description": "test",
"iconUrl": "",
"name": "Closed",
"id": "6",
"statusCategory": {
"self": "https://jiraurl/rest/api/2/statuscategory/3",
"id": 3,
"key": "done",
"colorName": "green",
"name": "Done"
}
},
"issuetype": {
"self": "https://jiraurl/rest/api/2/issuetype/20",
"id": "20",
"description": "Problem ",
"iconUrl": "https://jiraurl/images/icons/issuetypes/documentation.png",
"name": "Problem",
"subtask": false
}
}
}
}

]

Python声明,我们认为问题在于:

如果(problem[‘fields’][‘issuelinks’][0][‘outwardIssue’](和(problem[‘fields'][‘ssuelinks‘][0][’type‘][‘outward’]="源自"(:isitanisue=错误

我不明白为什么它一直停留在"outwardIssue"上?

试试这个:

issue = jira.issue("XX)
if (issue.raw['fields']['issuelinks'][0]['outwardIssue']) and (issue.raw['fields']['issuelinks'][0]['type']['outward'] == "arises from"): isitanissue = False

相关内容

  • 没有找到相关文章

最新更新