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.
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 JIRA
import jira
jira_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
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 projects
proj_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.name
if project_key not in proj_dict:
jra = jira.project(project_key)
proj_dict[project_key] = jra
else:
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_results
print(len(project_data))
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.