DEV Community

crhodes
crhodes

Posted on

Sending a GET Request to GitHub API asking for a list of commit messages in a Pull Request

I want my Python Flask server to send a GET Request to the GitHub REST API V3, asking for all commits messages in a Pull Request, and perhaps receive it as a single payload.

Any suggestions on how I can approach this issue?

Top comments (3)

Collapse
 
rhymes profile image
rhymes

Hi, there's an edpoint for that: developer.github.com/v3/pulls/#lis...

You either write the client yourself, using requests for example or you can use PyGithub and its method PullRequest.get_commits()

Collapse
 
crhodes2 profile image
crhodes

That's what I'm doing.

But the only thing I'm getting at this point is the number of commits as a count. (e.g. 13 if a PR has 13 commits, or 25 if another PR has 25 commits). I get a commit but I want to be able to display the messages associated with it.

Collapse
 
rhymes profile image
rhymes

You don't get the commit part of the response? There's a message key in the dictionary. Maybe is it a bug in the client you're using?