I am trying to list all isues in a project with status Done or Closed
. When I run a JQL-query with advanced search I get: 3096 issues in the project. However when I run it with python I get around 50 issues.
#/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
I am only getting 50 or so issues even though there is more than 3000 issues with the status Done
or Closed
with a JQL query.
Is there maybe a limit?
From the docs at https://pythonhosted.org/jira/:
search_issues(jql_str, startAt=0, maxResults=50, validate_query=True,
fields=None, expand=None, json_result=None)
Note the maxResults
argument. I think you need to specify maxResults=False
. Alternatively, do it in a loop like:
got = 50
total = 0
while got==50:
issues = jira.search_issues('project=JA', startAt = total)
....
got = len(issues)
total += got