Just a heads up: On March 24, 2025, starting at 4:30pm CDT / 19:30 UTC, the site will be undergoing scheduled maintenance for a few hours. During this time, the site might be unavailable for a short while. Thanks for your patience.
×Hello all,
All the question is in the title, how to list ALL the issues of a project with JIRA python ?
Actually i've done this code :
def simple_issue(projects):
i = jira.search_issues('issuetype=Bug', maxResults=None)
print(i)
But it list only 50 issues or less. It is due to the fact that issues during the search are shown by pages containing each 50 issues and the python package cannot access to the next pages. Do you know how could i do ?
Or then not to reach has the list of issues but to reach has the list of issuetypes present in the config of the project?
block_size = 100 block_num = 0 while True: start_idx = block_num*block_size issues = jira.search_issues(jql, start_idx, block_size) if len(issues) == 0: # Retrieve issues until there are no more to come break block_num += 1 for issue in issues: log.info('%s: %s' % (issue.key, issue.fields.summary))
it works, thank you !
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi all,
I tried this code and got an error for name 'jql'
[SOLVED]
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Then later on when I'm done with this error I get a new one for 'log'
[SOLVED]
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Solved how?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
#NOW SOLVED THANKS :)
while True:
start_idx = block_num * block_size
if block_num == 0:
issues = jira.search_issues(jql, start_idx, block_size)
else:
more_issue = jira.search_issues(jql, start_idx, block_size)
if len(more_issue)>0:
for x in more_issue:
issues.append(x)
else:
break
if len(issues) == 0:
# Retrieve issues until there are no more to come
break
block_num += 1
print(len(issues))
for issue in issues:
print('hi %s: %s' % (issue.key, issue.fields.summary))
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
see args of the function...
search_issues
(jql_str, startAt=0, maxResults=50, validate_query=True, fields=None, expand=None, json_result=None)
use startAt and maxResults looping round incrementing StartAt by maxResults
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
def simple_issue(projects):
i = jira.search_issues("project=project_name", startAt=0, maxResults=50, validate_query=True, fields=None, expand=None, json_result=None)
print(i)
It list 50 issues too ...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
That is because you are still specifying maxResults=50, try changing to maxResults=2000
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The server won't return more than a configured number of results at most.
I believe the default is 1000.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Can you please post full python script. I am having issues getting connection 405 error.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
405 has nothing to do with your script, it happens when you are attempting to pass back a file that does not have the necessary permissions on the server to receive Post information from another script.
In other words, your script is asking Jira to do something it does not have permissions to do. Check what you are asking is correct and the user has the correct permissions
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Nic
Thanks for response
Here is the script: (I am using Jira 7.4.4 )
import httplib
import urllib
import json
conn = httplib.HTTPConnection("myjira:2002")
args = urllib.urlencode({'username':'myuser', 'password':'mypassword'})
headers = {'accept':'application/json'}
r1 = conn.request("post","/rest/auth/1/session",args, headers)
# --- Authenticate to jira ----------------
r2 = conn.getresponse()
print r1,r2.status,r2.reason,r2
Not sure what is wrong?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Nor do I. 405 means you don't have permission to post. Are you sure you have the right url, the right user details and that the call you are making is supposed to be a post? And are you sure python sends it over in the right format?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I am admin on Jira and using same credentials. Is there anyway to find out more info for debugging.
Url is fine as I use same url for logging from browser.
The call I am making is a post as you can see in code
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
tested using postman and I get 415 error: Unsupported Meda type
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Logs atlassian-jira-security.log shows this:
http-nio-2002-exec-829 myuser 826x10767233x1 86f8ya 1yy.1xx.2xx.xxx /rest/auth/1/session The user 'myuser' has PASSED authentication.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Good morning. Looking at the response:
i = jira.search_issues("project=project_name", startAt=0, maxResults=50, validate_query=True, fields=None, expand=None, json_result=None)
print(i)
is there a wildcard that I can use for project? Of course I tried "*" but that didn't work. I haven't been able to figure that out. Thanks.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Have you tried using maxResults=sys.maxint (or sys.maxsize if using Python 3)?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
import sys ?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Here's another solution to this old question: I found, in the args of the function, this:
If maxResults evaluates as False, it will try to get all issues in batches.
So, if you just set maxResults=False, it will automagically return all the results. You don't have to guess at a number you 'think' might be higher than the actual number of results or do all of the batching manually.
issues = jira.search_issues(jql_str, maxResults=False)
HTH,
Brian
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
This is a really old question but I was wondering the same thing. My solution is slightly different from the ones mentioned above.
To remove the default limit of 50 issues, set the limit to something like this:
jira.jql(jql, limit=1000)
Hope this was helpful.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
import jira.client
from jira.client import JIRA
jira_options={'server': 'https://jira.com'}
jira=JIRA(options=jira_options,basic_auth=('admin','password'))
issues_in_project = jira.search_issues('JQL',startAt=0, maxResults=2000, validate_query=True, fields=None, expand=None, json_result=None)
print (issues_in_project)
This will work for you.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Shiva,
Using your code it is giving just 100, where my expected answer is 455.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You can set the startAt index to be something else lets say 200 and maxResults to be 300 and it will give issues within that frame. This way you can find others as well and concatenate them. At a time, it gives max 100 issues only.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.