我试图列出具有状态的项目中的所有项目Done or Closed.当我使用高级搜索运行JQL查询时,我得到:项目中的3096个问题.然而,当我用python运行它时,我得到了大约50个问题.
#/usr/bin/python
import jira.client
from jira.client import JIRA
options = {'server': 'http://jira.confluence.no' }
jira = JIRA(options, batch_auth=('admin', 'admin'))
project = jira.projects()
for project in projects:
issues = jira.search_issues('project=JA')
for issue in issues:
if str(issue.fields.status) == 'Done' or str(issue.fields.status) == 'Closed':
print issue
Run Code Online (Sandbox Code Playgroud)
即使状态Done或ClosedJQL查询存在超过3000个问题,我只会遇到50个左右的问题.
可能有限制吗?
来自https://pythonhosted.org/jira/的文档:
search_issues(jql_str, startAt=0, maxResults=50, validate_query=True,
fields=None, expand=None, json_result=None)
Run Code Online (Sandbox Code Playgroud)
注意这个maxResults论点.我想你需要指明maxResults=False.或者,在循环中执行以下操作:
got = 50
total = 0
while got==50:
issues = jira.search_issues('project=JA', startAt = total)
....
got = len(issues)
total += got
Run Code Online (Sandbox Code Playgroud)