Hi there!
First of all, let me say that this question was already asked in the link below, but has not been solved. The last reply was in December 2022.
https://community.atlassian.com/t5/Jira-questions/Return-more-than-5000-worklogs-for-a-given-issue/qaq-p/2215910
I´ve been using the jira module that I believe is the official one and the worklogs function doesn't have a maxResults parameter.
I'm using jira==3.8.0
This is my code (with credentials and issue name removed):
from jira import JIRAimport jirajira_options = {'server':server}credentials = (email,token)client = JIRA(options = jira_options,basic_auth = credentials)issue = client.issue('myissue')print(a.fields.worklog.total) # This line prints 9574 in my case.# Can't use maxResults, I get:# TypeError: worklogs() got an unexpected keyword argument 'maxResults'work = self.client.worklogs(issue = issue) # Without maxResults it works.print(len(work)) # This line prints 5000.
Thank you
Hi @Agustin Rovero
The limit for max results is set on the server side, 5000 is actually very high! Generally it's 1000
You would need to set a loop to go through pages
This is the code we use:
# Run the JQL query and get the projectsproj_dict = {}while True: issues = jira.search_issues(jql_query, maxResults=max_results, startAt=start_at)# If no issues are returned, we're done. if not issues:break # Extract the key, project name, and project lead from the issues for issue in issues: project_key = issue.fields.project.key project_name = issue.fields.project.nameif project_key not in proj_dict: jra = jira.project(project_key) proj_dict[project_key] = jraelse: jra = proj_dict[project_key] project_lead = jra.lead.displayName project_data.append({'project_key': project_key,'project_name': project_name,'project_lead': project_lead, })# Update startAt for the next batch of issues. print(project_data[start_at:start_at+max_results]) start_at += max_resultsprint(len(project_data))
Ok, thank you very much.
It looks like you're new here. Sign in or register to get started.