如何使用 jira-python 检索与 JIRA 票证关联的 'links'?

How to retrieve the 'links' associated with a JIRA ticket using jira-python?

我正在尝试使用以下表达式来检索有关带有 jira-python 的 JIRA 票证的数据,包括链接:

issue = self.jira.search_issues("key=MYPR-11", fields=["links", "worklogs", "created","timetracking", "updated", "status", "Severity", "priority", "type", "fixVersions", "affectedVersions","components", "labels", "reporter", "assignee"])

但是在查看可用字段时,似乎缺少 'links':

print(dir(issue.fields))
['__class__', '__delattr__', '__dict__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', 'assignee', 'components', 'created', 'customfield_10010', 'fixVersions', 'issuetype', 'labels', 'priority', 'reporter', 'status', 'timetracking', 'updated']

知道如何使用 `jira-python 查询 'links' 信息吗?

我不太确定您想要什么 links,但我假设您需要问题链接。您使用了错误的字段名。该字段不是 links,而是称为 issuelinks

issue = self.jira.search_issues("key=MYPR-11", fields=["issuelinks", "worklogs", "created","timetracking", "updated", "status", "Severity", "priority", "type", "fixVersions", "affectedVersions","components", "labels", "reporter", "assignee"])

如果您想拥有所有可用字段,请尝试 *all 包含所有字段。 https://docs.atlassian.com/software/jira/docs/api/REST/latest/#api/2/issue-getIssue

我不确定jira-python是否支持这个

编辑

如@Alex 所述:如果未指定任何字段,则返回所有可用字段。