from types import ClassMethodDescriptorType from jira import JIRA import csv import xlsxwriter # TODO: create excel! host = "https://jira.wien.gv.at/" pat = "OTAyMTM3MjY0MjE0Ovz6bu0ti1TlEdSegmmiWiJ2wGeD" headers = JIRA.DEFAULT_OPTIONS["headers"].copy() headers["Authorization"] = f"Bearer {pat}" jira_server = JIRA(server=host, options={"headers": headers}) #jira_server = JIRA(basic_auth=("zim9003",""), options={'server': 'https://jira.wien.gv.at/'}) #jira_server = JIRA(basic_auth=("postman","OTAyMTM3MjY0MjE0Ovz6bu0ti1TlEdSegmmiWiJ2wGeD"), options={'server': 'https://jira.wien.gv.at/'}) #issues_Jql = jira_server.issue('WRGWR-828',expand='changelog')#pass one issue at the time assignees = ["thh9001","krp9002","reu9001","und9001","krj0003","bln9001","ce39001","rab9001"] for assignee in assignees: issues_Jql = jira_server.search_issues('sprint = 1137 AND assignee = {} ORDER BY cf[10022] ASC'.format(assignee)) #, expand='changelog') # 1093 xsp = lambda s: s or 0 sp_sum = 0 for issue in issues_Jql: sp = 0 if hasattr(issue.fields, 'customfield_10022'): sp = xsp(issue.fields.customfield_10022) sp_sum += sp print('{}: {}, SP: {}'.format(issue.key, issue.fields.summary, sp)) print('Summe {}: {}'.format(assignee, sp_sum)) #print(issues_Jql) # changelog = issues_Jql. # count = 0 # for history in changelog.histories: # for item in history.items: # if item.field == 'status': # if item.toString == "Reopened": # count = count + 1 # print(count)