python jira 数据爬取bug和子任务清单

python

python;gutter:true;">import  requests

import urllib3

urllib3.disable_warnings()

from jira import JIRA

import pandas as pd

def login_jira(username,password):

jira = JIRA("https://jira.mypaas.com.cn",basic_auth=(username,password))

projects=jira.project(id=10902)

# jql=\'project="云链-供应链中台-材料域" AND created >= 2020-07-1 AND created <=now() \'

issues=jira.search_issues(\'project="云链-供应链中台-材料域" AND creator=currentUser() order by created DESC\', maxResults=1000)

a=["key","标题","状态","子任务","createtime","项目名","link","优先级",\'version\',\'解决时间\',"对应开发","问题类型","问题报告人"]

datas=[]

for index,issue in enumerate(issues):

# b = [issue.key, issue.fields.summary, issue.fields.status, issue.fields.subtasks, issue.fields.created,

# issue.fields.project.name,

# issue.self, issue.fields.priority, issue.fields.description, issue.fields.versions[0].name if len(issue.fields.versions)>0 else None,

# issue.fields.resolutiondate, issue.fields.assignee, issue.fields.issuetype,"陈权"]

b = [issue.key, issue.fields.summary, issue.fields.status, issue.fields.subtasks, issue.fields.created,

issue.fields.project.name,

issue.self, issue.fields.priority, issue.fields.versions[0].name if len(issue.fields.versions)>0 else None,

issue.fields.resolutiondate, issue.fields.assignee, issue.fields.issuetype,"彭甜甜"]

datas.append(b)

print(datas)

df=pd.DataFrame(datas,columns=a)

# pd.DataFrame.from_dict(datas,orient=\'index\',columns=[a])

print(df)

df_tmp=df.query("状态!=\'完成\'")

df_tmp.to_csv("./static_excel_ptt.csv", encoding=\'utf_8_sig\',header=["key","标题","状态","子任务","createtime","项目名","link","优先级",\'version\',\'解决时间\',"对应开发","问题类型","问题报告人"])

return jira

def get_comments_content(issue):

return [comment.body for comment in issue.fields.comment.comments]

if __name__ == \'__main__\':

login_jira("pengtt01","hello")

  

以上是 python jira 数据爬取bug和子任务清单 的全部内容, 来源链接: utcz.com/z/388747.html

回到顶部