Here's a way to get all issues - or a desired max number - using the pagination capability of the API. This gets as many issues as possible with each call to search_issues
, stopping when the requested max number is reached or there are no more available issues.
def get_issues(jira, query, max=(1<<31)-1):
issues = []
start = 0
done = False
while not done:
nextpage = jira.search_issues(query, startAt=start, maxResults=(max - start))
issues.extend(nextpage)
start = start + len(nextpage)
done = (start >= max) or (len(nextpage) == 0)
return issues
With this, the OP's issue search becomes:
all_issues = get_issues(jira, 'project=ProjectName')
But if you only want the first 100 issues, use this instead:
all_issues = get_issues(jira, 'project=ProjectName', max=100)
This is more efficient than calling search_issues
with maxResults=False
, which internally paginates through all issues.
The default value of max
is 2^31 - 1, the largest positive signed 32-bit integer, which is the highest value supported by the JIRA API.