Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Removing Jira tags from query python code

Karthikeyan duraiswamy
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
November 27, 2018

Hi All,

    I am trying python code getting info from Jira and create some metrics for our project.

below are two lines of codes.  Python-Jira

issues_epic = jira.search_issues('issuetype = epic and project in ("Immuno Process")  AND created >= -90d',maxResults=None)
epic_fixversion = Counter([str(issue.fields.fixVersions) for issue in issues_epic])
print(epic_fixversion)

get output as follow

Counter({"[<JIRA Version: name='v2.6.0 Inc3', id='16506'>]": 14, "[<JIRA Version: name='2.6 inc 2', id='16503'>]": 5, "[<JIRA Version: name='3.0 Inc 2', id='16029'>]": 3, "[<JIRA Version: name='3.0 Inc 3', id='16410'>]": 3, "[<JIRA Version: name='2.5', id='16024'>, <JIRA Version: name='2.6 inc 2', id='16503'>]": 1})

How to remove the tags <JIRA Version: name>...I need only the values 'v2.6.0 Inc3' in the counter keys..not the tags as well.

This works fine for the resolution Jira field

temp_resou = Counter([str(issue.fields.resolution) for issue in issues_stories])

Counter({'Done': 246, 'None': 92, 'Fixed': 22, 'Resolved': 8, "Won't Do": 6, 'Duplicate': 3})

1 answer

0 votes
Gonchik Tsymzhitov
Community Champion
January 28, 2021

you need to iterate by method like 

for i in Counter:

   print(i.name)

Suggest an answer

Log in or Sign up to answer