Hi.. I am using the below code as suggested in my previous query in the community.
This code is helping me to iterate through all the pages for extracting the complete list of issues from API. But the code is failing exactly after 2000+ rows approx and throwing an error message as highlighted below. I have no clue on how to make this code work.
Traceback (most recent call last):
File "C:\Users\John\Anaconda3\lib\site-packages\requests\models.py", line 971, in json
return complexjson.loads(self.text, **kwargs)
File "C:\ Users\John\Anaconda3\lib\json\__init__.py", line 346, in loads
return _default_decoder.decode(s)
File "C:\Users\John\Anaconda3\lib\json\decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "C:\Users\John\Anaconda3\lib\json\decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
Solved: JIRA API code to resolve pagination for issue sear... (atlassian.com)
import requests
from requests.auth
import HTTPBasicAuth
import json
url = "https://dataanalystteam.atlassian.net/rest/api/3/search"
auth = HTTPBasicAuth("Email", "API Token")
headers = {
"Accept": "application/json"
}
query = {
'jql': 'project = ITSAMPLE',"startAt": 0, "maxResults": 500
}
response = requests.request(
"GET",
url,
headers=headers,
params=query,
auth=auth
)
results = response.json()
while query["startAt"] < results["total"]:
query["startAt"] += 50
response = requests.request(
"GET",
url,
headers=headers,
params=query,
auth=auth
)
results = response.json()
for issue in results["issues"]:
print(issue["key"] + " | " + issue["fields"]["summary"])
@Marini Marini @Marini Marini