網站首頁 編程語言 正文
JIRA介紹:
? ? ? JIRA是Atlassian公司出品的項目與事務跟蹤工具,被廣泛應用于缺陷跟蹤、需求收集、流程審批、任務跟蹤、項目跟蹤和敏捷管理等工作領域.
? ? ? 在開發工作中,Jira通常用作BUG管理和任務跟蹤管理等,項目經理,測試人員,開發人員等在Jira上進行提交BUG,提交任務,修改任務進度等操作.下面我們看下python操作jira添加模塊的方法。
python操作jira
首先安裝jira模塊
$ pip install jira
導入jira模塊
from jira import JIRA
import xlrd # 導入xlrd,xlrd可以支持讀取xls文件,不支持讀取xlsx
編寫添加模塊代碼
下面展示一些 內聯代碼片
。
def add_module_to_jira(jiraurl,username,password,modulename,projectKey): myjira = JIRA(jiraurl, basic_auth=(username, password)) myjira.create_component(modulename,projectKey)
獲取當前項目的模塊信息
def get_project_compopents(jiraurl,username,password,projectKey): myjira = JIRA(jiraurl, basic_auth=(username, password)) return myjira.project_components(projectKey)
從excel表讀取信息
def read_xls(xls_path,sheetName): worksheet = xlrd.open_workbook(xls_path) # 打開excel文件,參數為文件的路徑 sheet_names = worksheet.sheet_names() # 獲取excel文件的所有sheet頁,返回名字列表, # sheet_name=worksheet.sheet_by_name('Sheet1')# print(sheet_names) # print(sheet_name) sheet = worksheet.sheet_by_name(sheetName) # 獲取到sheet名稱為Sheet1的sheet頁 row = sheet.nrows # 獲取文件行數 cow = sheet.ncols # 獲取文件列數 scores = sheet.col_values(4, 1, row) scoreslsit = [] for score in scores: # scorelist = score.split('&') # print(scorelist) print(score) scoreslsit.append(score) return scoreslsit
主方法中調用添加模塊等方法
ss=get_project_compopents(jiraurl,username,password,projectKey=projectkey) module=[] print(ss) for one in ss: print(one.name) module.append(one.name) print('ssss',len(ss)) print(module) print("module:",len(module)) modunameList = read_xls(r'D:\test9.xls', 'Sheet1') print(modunameList) print("modulist的長度",len(modunameList)) modulenew=[] moduleold=[] for one in modunameList: if one in module: moduleold.append(one) continue else: modulenew.append(one) print("modulnew的內容如下:") print(modulenew) print("modulnew的長度是",len(modulenew)) print("moduleOld是------------") print(moduleold) print("moduleOld是------------") for moduname in modulenew: print(moduname) add_module_to_jira(jiraurl=jiraurl,username=username,password=password,modulename=moduname,projectKey=projectkey)
原文鏈接:https://blog.csdn.net/wangchao_ad/article/details/123509125
相關推薦
- 2022-02-27 Web server failed to start. Port XXXX was already
- 2022-10-15 Windows10搭建FTP服務器詳細教程_FTP服務器
- 2022-10-24 Android性能優化之ViewPagers?+?Fragment緩存優化_Android
- 2022-06-19 C#文件非占用讀取與幫助類FileHelper_C#教程
- 2023-09-12 如何升級spring boot中spring框架的版本
- 2022-06-27 ASP.NET?MVC開發接入微信公共平臺_實用技巧
- 2022-01-30 h5 uniapp history模式下刷新頁面404
- 2023-03-01 Android使用AndroidUtilCode實現多語言_Android
- 最近更新
-
- window11 系統安裝 yarn
- 超詳細win安裝深度學習環境2025年最新版(
- Linux 中運行的top命令 怎么退出?
- MySQL 中decimal 的用法? 存儲小
- get 、set 、toString 方法的使
- @Resource和 @Autowired注解
- Java基礎操作-- 運算符,流程控制 Flo
- 1. Int 和Integer 的區別,Jav
- spring @retryable不生效的一種
- Spring Security之認證信息的處理
- Spring Security之認證過濾器
- Spring Security概述快速入門
- Spring Security之配置體系
- 【SpringBoot】SpringCache
- Spring Security之基于方法配置權
- redisson分布式鎖中waittime的設
- maven:解決release錯誤:Artif
- restTemplate使用總結
- Spring Security之安全異常處理
- MybatisPlus優雅實現加密?
- Spring ioc容器與Bean的生命周期。
- 【探索SpringCloud】服務發現-Nac
- Spring Security之基于HttpR
- Redis 底層數據結構-簡單動態字符串(SD
- arthas操作spring被代理目標對象命令
- Spring中的單例模式應用詳解
- 聊聊消息隊列,發送消息的4種方式
- bootspring第三方資源配置管理
- GIT同步修改后的遠程分支