Get fields from a specific Jira issue

Kobi K picture Kobi K · Jun 3, 2015 · Viewed 38.6k times · Source

I'm trying to get all the fields and values from a specific issue my code:

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()

Instead of returning the list of fields it returns:

<jira.resources.PropertyHolder object at 0x108431390>

Answer

ThePavolC picture ThePavolC · Jun 3, 2015
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]

Depends on field type, sometimes you get dictionary as a value and then you have to find the actual value you want.