Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

what is the best way get the commits from jira using python script ?

t-gajula December 23, 2019

I have script for get the tickets from JIra  i am not able to get the commits from development filed.

2 answers

0 votes
Aleksey Plisko July 21, 2022

import requests
from requests.auth import HTTPBasicAuth
import json

url = "https://xxxxx.atlassian.net/rest/dev-status/latest/issue/detail?issueId=xxxxx&applicationType=bitbucket&dataType=repository"

auth = HTTPBasicAuth("email", "api_token")

headers = {
"Accept": "application/json"
}

response = requests.request(
"GET",
url,
headers=headers,
auth=auth
)

d_myjson = json.loads(response.text)

num_repo = len(d_myjson['detail'][0]['repositories'])
num_commits = len(d_myjson['detail'][0]['repositories'][0]['commits'])

0 votes
brbojorque
Community Champion
December 23, 2019

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events