编程语言
首页 > 编程语言> > Python和JIRA从特定问题中获取字段

Python和JIRA从特定问题中获取字段

作者:互联网

我正在尝试从特定问题获取所有字段和值我的代码:

authenticated_jira = JIRA(options={'server': self.jira_server}, basic_auth=(self.jira_username, self.jira_password))
issue = authenticated_jira.issue(self.id) 
print issue.fields()

而不是返回它返回的字段列表:

<jira.resources.PropertyHolder object at 0x108431390>

解决方法:

authenticated_jira = JIRA(options={'server': self.jira_server}, basic_auth=(self.jira_username, self.jira_password))
issue = authenticated_jira.issue(self.id) 

for field_name in issue.raw['fields']:
    print "Field:", field_name, "Value:", issue.raw['fields'][field_name]

取决于字段类型,有时您将字典作为值,然后您必须找到您想要的实际值.

标签:python,jira-rest-api,python-jira
来源: https://codeday.me/bug/20190712/1437806.html