python调用jira接口
#!/usr/bin/env python # -*- coding: utf-8 -*- import requests def DataDic(): url = 'http://jira.xxx.com/rest/gadget/1.0/login' auth = { "os_username": "登录账号", "os_password": "登录密码", "os_cookie": "true", "os_captcha": "" } session = requests.session() session.post(url, auth) #jira的高级查询sql today_deploy_plan = "project = BCM" payload = { "jql": today_deploy_plan, #根据判断条件取出的条数,默认是取300-400之间 'maxResults':5000 } uri = "http://jira.xxx.com/rest/api/2/search" rep = session.get(uri, params=payload) if rep.status_code == 200: datalist = rep.json() else: print("服务器返回异常") return datalist