创建Jira后检索Jira ID

时间:2019-03-21 19:20:53

标签: python jira python-jira

我想检查发送请求后是否可以返回问题ID。

下面是我的代码

issue_dict = {
    'project': {'id': 123},
    'summary': 'New issue from jira-python',
    'description': 'Look into this one',
    'issuetype': {'name': 'Bug'},
}
new_issue = jira.create_issue(fields=issue_dict)

有没有办法,我可以在这里检索问题ID,还是需要设置另一个查询?

谢谢

1 个答案:

答案 0 :(得分:2)

根据documentation create_issue将返回一个Issue,其中包含ID和发布密钥。

issue_dict = {
    'project': {'id': 123},
    'summary': 'New issue from jira-python',
    'description': 'Look into this one',
    'issuetype': {'name': 'Bug'},
}
new_issue = jira.create_issue(fields=issue_dict)
print(new_issue.id)
print(new_issue.key)