michaelliao/githubpy

Comments on issues

Closed this issue · 1 comments

Hi. I would like to know how to work with comments over a specific issue.

Let's think of issue number 8 in my repo:

issue = gh.repos(USERNAME)(REPO).issues(8).get()

That works fine, Im able to print title, body and so on. But, I don'w know how to iterate over the comments that the issue has.

In the case, this punctual issue has 2 comments. How do I access the second comment over the issue ?

Thanks.
Juan

twidi commented

This library is really easy to use because it magically do what you ask it to do.

Looking at the github API https://developer.github.com/v3/issues/comments/#list-comments-on-an-issue you see that a new part in the path is added, comments

So to follow you example, it is as simple as:

comments = gh.repos(USERNAME)(REPO).issues(8).comments.get()