import requests
import urllib3
urllib3.disable_warnings()
from jira import JIRA
import pandas as pd
def login_jira(username,password):
jira = JIRA("https://jira.cn/",basic_auth=(username,password))
#projects=jira.project(id=13)
# jql='project="云链-供应链中台-材料域" AND created >= 2020-07-1 AND created <=now() '
testIssue = jira.issue("jira-13244")
print(testIssue)
#issues=jira.search_issues('project="PS" AND creator=currentUser() order by created DESC', maxResults=1000)
issues=jira.search_issues('project="PS" AND assignee=currentUser() AND updated > "-1d" AND assignee=currentUser() AND (status="待处理" OR status="开发中" OR status="待开发" OR status = "重新打开" OR status = "修复中") order by priority DESC', maxResults=1000)
a=["key","标题","状态","子任务","createtime","项目名","link","优先级",'解决时间',"对应开发","问题类型","问题报告人"]
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.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","优先级",'解决时间',"对应开发","问题类型","问题报告人"])
return jira
def get_comments_content(issue):
return [comment.body for comment in issue.fields.comment.comments]
if __name__ == '__main__':
login_jira("user","pswd")
import requests
import urllib3
urllib3.disable_warnings()
from jira import JIRA
import pandas as pd
def login_jira(username,password):
jira = JIRA("https://jira.cn/",basic_auth=(username,password))
#projects=jira.project(id=13)
# jql='project="云链-供应链中台-材料域" AND created >= 2020-07-1 AND created <=now() '
testIssue = jira.issue("jira-13244")
print(testIssue)
#issues=jira.search_issues('project="PS" AND creator=currentUser() order by created DESC', maxResults=1000)
issues=jira.search_issues('project="PS" AND assignee=currentUser() AND updated > "-1d" AND assignee=currentUser() AND (status="待验证" OR status="开发中" OR status="进行中" OR status="修复中") order by priority DESC', maxResults=1000)
a=["key","标题","状态","子任务","createtime","项目名","link","优先级",'解决时间',"对应开发","问题类型","问题报告人"]
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.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","优先级",'解决时间',"对应开发","问题类型","问题报告人"])
return jira
def get_comments_content(issue):
return [comment.body for comment in issue.fields.comment.comments]
if __name__ == '__main__':
login_jira("user","pswd")
创作不易,小小的支持一下吧!