python调用jira接口

a 夏天 提交于 2020-04-11 17:40:18

官方文档:https://jira.readthedocs.io/en/master/

官方文档:https://docs.atlassian.com/DAC/rest/jira/6.1.html#d2e864

优秀博客:https://blog.csdn.net/weixin_43790276/article/details/89892699

先安装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页面项目列表对照一下,是完整且正确的。

 

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!