python - 如何使用 JIRA python API 将观察者添加到 JIRA 票证

标签 python python-2.7 jira jira-rest-api python-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 - 如何使用 JIRA python API 将观察者添加到 JIRA 票证,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28233268/

相关文章:

python - TypeError 使用 BOTO 库将图像文件上传到 Django 中的 Amazon S3

python - PyTorch : predict single example

java - Jira Rest Java 客户端的 ClassNotDef 异常

jira - JQL:显示当前sprint中故事的所有子任务

python - numpy.amax 中的一个键

python - 外部文件中的 SQLAlchemy 枚举

python - 为什么 yield 生成的生成器比 xrange 生成的生成器快?

Python:组合两个字符串并从中选择唯一元素

python - 在 n 时间后,我将如何停止 while 循环?

java - 当 Java 作为 Web 应用程序运行时,Jira 显示 NoSuchMethodError,但在 main 中运行时获取输出