我有一个python脚本,可以从jira中提取所有字段。我在jira中有多个项目,每个项目中的列集是不同的。因此我有下面的脚本,工作得很好。
## Login to Jira
jira = JIRA(basic_auth=('login@login.com', 'password'), options={'server': 'https://company.atlassian.net'})
# Pulling Proj_A tickets
issues = jira.search_issues('project= Proj_A',maxResults=False) ## Get Proj_A tickets
## Create the full df by normalizing the output
issue_list = []
for i in range(len(issues)):
result = json_normalize(issues[i].raw['fields'])
result['issue_id'] = issues[i]
result['issue_link'] = 'https://company.atlassian.net/browse/' + str(issues[i])
issue_list.append(result)
final_issue_df_a = pd.concat(issue_list, axis=0, sort=True).reset_index()
# Pulling Proj_B tickets
issues = jira.search_issues('project= Proj_B',maxResults=False) ## Get Proj_B tickets
## Create the full df by normalizing the output
issue_list = []
for i in range(len(issues)):
result = json_normalize(issues[i].raw['fields'])
result['issue_id'] = issues[i]
result['issue_link'] = 'https://company.atlassian.net/browse/' + str(issues[i])
issue_list.append(result)
final_issue_df_b = pd.concat(issue_list, axis=0, sort=True).reset_index()
# Concatenating fields from the 2 projects into one single dataframe
Final_DF = pd.concat([final_issue_df_a,final_issue_df_b], axis=0, ignore_index=True)
上面的代码工作得很好。现在我正在尝试优化脚本,其中我正在尝试传递一个循环,该循环包含以下所有项目的列表:
project = [Proj_A,Proj_B,Proj_C..]
它被传递到第一行
(issues = jira.search_issues('project=',maxResults=False))
并迭代每个项目并拉入存储在最终数据帧中的相关字段。
有人能帮忙吗?谢谢