0

Could you please help to get Tag and Sprint value for particular issue

import jira.client
from jira.client import JIRA

options = {'server': 'https://example.com', 'verify':False}
jira = JIRA(options, basic_auth=('user', 'password'))
issues_in_project = jira.search_issues('project=11372 AND SPRINT not in 
closedSprints() AND sprint not in futureSprints()')
for value in issues_in_project:
print value.key , value.fields.summary , value.fields.assignee , 
value.fields.reporter ,value.fields.updated ,value.fields.resolutiondate, 
value.fields.duedate, value.fields.labels,value.fields.tag

While running the python script , I got error

DWD-9933 Loading and Validating Products username username 2018-04-02T23:27:07.000-0700 None 2018-04-06 [u'DW-Products'] Traceback (most recent call last): File "jira_test.py", line 23, in print value.key , value.fields.summary , value.fields.assignee , value.fields.reporter ,value.fields.updated ,value.fields.resolutiondate, value.fields.duedate, value.fields.labels,value.fields.tag AttributeError: type object 'PropertyHolder' has no attribute 'tag'

Please have a look once and help me to achieve this

Thanks,

kritikaTalwar
  • 1,730
  • 1
  • 17
  • 25
Himanshu Pant
  • 37
  • 1
  • 4
  • 11

1 Answers1

0

For standart attributes use getattr built-in method with field name (which is technically id). Some fields can be custom and their id look something like this customfield_15100. Here is how to get JSON with all your fields info https://confluence.atlassian.com/jirakb/how-to-find-id-for-custom-field-s-744522503.html.

So in your case, tag could be a custom field.

for value in issues_in_project:

   # standart field
   print(getattr(value.fields(), 'reporter'))
   print(getattr(value.fields(), 'summary'))

   # custom field
   print(getattr(value.fields(), 'customfield_15100'))
Alex
  • 2,074
  • 1
  • 15
  • 14