Rev Leon Lonnie Love
damned mine eyes, DAMNED mine eyes!!
I just read the docs now. So it seems like to get a comment of an issue, you have to access it using the instance you created of the JIRA class. It has two methods tto access a comment: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.
- comment : this method takes an issue instance object as its input plus the issue's ID and then returns the comment as an instance of the jira.Comment class. you can use methods provided by this Comment class to accomplish whatever it is you want. here is the Comment class documentation: 6. API Documentation — jira-python 0.1.dev50+g7fa3a45 documentation
- comments: this method returns a list of Comment class objects for a particular issue. Im assuming this is probably what you want since you want to access all comments per issue.
Example
-----------
Code:
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)
# update comment
comment_list = jira.comments(issue)
for comment in comment_list:
# re-write all comments
comment.update(body='im a coli poster')
except:
print("Error")
continue
It seems like there is very limited stuff you can do with the Comment objects because they only have one public method: "update()", and looking at its source it seems like the only usable parameters of that update method are "body" and "visibility". Comment is a subclass of the Resource class so you can extend the Comment class by making you own and then dig into the Resource class to create your custom methods that accomplish whatever task you can do. See the resource class source code here: jira.resources — jira-python 0.1.dev50+g7fa3a45 documentation
I hope this helps somehow. Let me know how it goes @Sonny Bonds