-
Notifications
You must be signed in to change notification settings - Fork 0
/
jia_git_all_issues.py
38 lines (33 loc) · 1 KB
/
jia_git_all_issues.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import requests
import json
import base64
# USE TO GET ALL ISSUES IN JIRA
# Base encode email and api token
cred = "Basic " + base64.b64encode(b'myemail@otg.com:pQcIDzMucUS76VBUmwzp2012').decode("utf-8")
# Set header parameters
headers = {
"Accept": "application/json",
"Content-Type": "application/json",
"Authorization" : cred
}
# Enter your project key here
projectKey = "PKY"
# Update your site url
url = "https://mysite.atlassian.net/rest/api/3/search?jql=project=" + projectKey
# Send request and get response
response = requests.request(
"GET",
url,
headers=headers
)
# Decode Json string to Python
json_data = json.loads(response.text)
# Display issues
for item in json_data["issues"]:
print(item["id"] + "\t" + item["key"] + "\t" +
item["fields"]["issuetype"]["name"] + "\t" +
item["fields"]["created"]+ "\t" +
item["fields"]["creator"]["displayName"] + "\t" +
item["fields"]["status"]["name"] + "\t" +
item["fields"]["summary"] + "\t"
)