Software Development and Programming Careers (Official Discussion Thread)

Obreh Winfrey

Truly Brehthtaking
Supporter
Joined
Nov 18, 2016
Messages
20,852
Reputation
25,252
Daps
131,941
Maybe a coli breh should help you :lolbron:
We ain't cheap
full
 

Sonny Bonds

Superstar
Supporter
Joined
Apr 24, 2014
Messages
4,622
Reputation
916
Daps
13,259
In Python

I'm connecting I've got 2 questions:
1. I'm connecting to the Jira API to pull ticket\issue data, how do I pull the all the comments for each issue?
2. How do I output JSON here?

from jira import JIRA
import requests
user = "jirauser"
apikey = "apikeyhere"
server = "https://insertnamehere.atlassian.net"

options = {
"server": server
}

jira = JIRA(options, basic_auth=(user,apikey))
size = 100
count = 0
while True:
start= count * size
project = "FINANCE"
issues = jira.search_issues("project= " + project, start,size)
if len(issues) == 0:
break
count += 1
try:
for issue in issues:
print("ticket-no: ", issue)
print("IssueType: ", issue.fields.issuetype.name)
print("Status: ", issue.fields.status.name)
print("Summary: ", issue.fields.summary)

except:
print("Error")
continue

I got daps, reps, and coli cash.
 

Obreh Winfrey

Truly Brehthtaking
Supporter
Joined
Nov 18, 2016
Messages
20,852
Reputation
25,252
Daps
131,941
In Python

I'm connecting I've got 2 questions:
1. I'm connecting to the Jira API to pull ticket\issue data, how do I pull the all the comments for each issue?
2. How do I output JSON here?



I got daps, reps, and coli cash.
jira.resources — jira-python 0.1.dev50+g7fa3a45 documentation
For 1 it looks like you can do something like
for c in issue.fields.comment:
# Do what you want with each comment
For 2 are you trying to get JSON from Jira? Or print your own JSON?
 

Sonny Bonds

Superstar
Supporter
Joined
Apr 24, 2014
Messages
4,622
Reputation
916
Daps
13,259

Sonny Bonds

Superstar
Supporter
Joined
Apr 24, 2014
Messages
4,622
Reputation
916
Daps
13,259
I think this is wrong, but JSON.parse(issue) might work.
I think I got it. I appended everytthing in the for loop into a list and then used JSON.dumps(list). It looks the same, but I think it's technically a JSON array now.
 

Sonny Bonds

Superstar
Supporter
Joined
Apr 24, 2014
Messages
4,622
Reputation
916
Daps
13,259
I still can't get these comments.

I'm also trying to use argparse to allow users to change the project variable via command line.

I hate this shyt.
 
Top