如何使用JIRA python API将观察者添加到JIRA票证
作者:互联网
我正在使用JIRA python API从我的代码创建JIRA票证.代码如下所示
from jira.client import JIRA
def create_jira_issue(jira, summary, description, status):
project = getattr(settings,'jira_project_' + status)
now = datetime.datetime.now()
pm_jira_dict = {
'project': {'key': getattr(settings,'jira_project_' + status)},
'summary': summary,
'description': description,
'issuetype': {'name': settings.jira_issuetype},
'assignee':{'name': settings.jira_assignee},
'timetracking':{'originalEstimate': settings.jira_timetracking},
'duedate':now.strftime('%Y-%m-%d %H:%M:%S')
}
new_issue = jira.create_issue(fields=pm_jira_dict)
return new_issue
现在我想为此票添加一个Watcher.我怎么能在这里添加它.
提前致谢.
解决方法:
假设您要添加的观察者位于变量“watcher”中:
加
jira.add_watcher(new_issue.id,watcher)
在代码段的末尾.
标签:python,python-2-7,jira,python-jira,jira-rest-api 来源: https://codeday.me/bug/20190824/1711825.html