官方文档:https://jira.readthedocs.io/en/master/
先安装jira库
pip install jira
from jira import JIRA jira = JIRA(auth=("username", "pwd"), options={‘server‘: ‘https://**.**.**.**‘}) projects = jira.projects() print(projects)
注意:
jira = JIRA(auth=("username", "pwd"), options={‘server‘: ‘https://**.**.**.**‘})
第一行中的参数是auth不是basic_auth,连接方式请参考文首最新的官方文档,其他文章均为basic_auth,导致连不上
输出:
是一个数组,每个项目由<>包围,key是关键字,name是项目名
[<JIRA Project: key=‘NEW‘, name=‘***项目‘, id=‘10433‘>, <JIRA Project: key=‘**‘, name=‘**‘, id=‘10467‘>, <JIRA Project: key=‘***‘, name=‘***重构‘, id=‘10501‘>, <JIRA Project: key=‘P2020021451‘, name=‘**‘, id=‘10502‘>, <JIRA Project: key=‘***‘, name=‘**工作‘, id=‘10481‘>, <JIRA Project: key=‘***‘, name=‘**工作‘, id=‘10490‘>, <JIRA Project: key=‘**‘, name=‘**申请‘, id=‘10446‘>, <JIRA Project: key=‘**‘, name=‘**‘, id=‘10613‘>]
可以和jira页面项目列表对照一下,是完整且正确的。
原文:https://www.cnblogs.com/gcgc/p/12674341.html