0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

jira python

Posted at
from jira import JIRA                                                           
import re                                                                       
                                                                                
def to_manday(sec):                                                             
        return sec/(60*60*7.75)                                                 
                                                                                
class Task:                                                                     
        p = re.compile('name=(.*?),')                                           
        def __init__(self, jira, issue):                                        
                f = issue.fields                                                
                self.summary = f.summary                                        
                #self.timeestimate = to_manday(f.timeestimate)                  
                self.aggregatetimeestimate = to_manday(f.aggregatetimeestimate) 
                self.sprint = Task.p.search(f.customfield_10019[0]).group(1)    
                self.assignee = f.assignee                                      
                self.progress = f.aggregateprogress.percent                     
                self.epicLink = jira.issue(f.customfield_10015).fields.summary if f.customfield_10015 is not None else ''
                                                                                
        def print(self):                                                        
                print(                                                          
                                self.summary,                                   
                                #"{0:.2f}".format(self.timeestimate),           
                                "{0:.2f}".format(self.aggregatetimeestimate),   
                                self.sprint,                                    
                                self.assignee,                                  
                                self.epicLink,                                  
                                self.progress,                                  
                                sep='\t')                                       
                                                                                
options = {                                                                     
        'server': 'https://hogehoge.atlassian.net'                                
}                                                                               
jira = JIRA(options=options,basic_auth=('mogamoga','xxxx'))                        
issues = jira.search_issues('fugafuga')                                   
# for i in issues:                                                               
#       sub = i.fields.subtasks                                                 
#       if len(sub) != 0:                                                       
#               for j in sub:                                                   
#                       issues.remove(j)                                        
                                                                                
sub = [j for i in issues for j in i.fields.subtasks]                            
issues = [i for i in issues if i not in sub]                                    
                                                                                
for i in issues:                                                                
        Task(jira, i).print()          

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?