Hello,

I'm trying to retrieve the number of commits and changed files on all pull 
requests submitted to a branch.

The call to get all the pull requests is GET /repos/:owner/:repo/pulls, but it 
does not return "commits" or "changed_files".

The call that returns number of commits and changed files is GET 
/repos/:owner/:repo/pulls/:number.



Any guidance on how I can modify the call below to include commits and changed 
files on all pull requests?


#!/usr/bin/env python
import json
import requests
import datetime
import sys
import codecs
sys.stdout = codecs.getwriter('utf8')(sys.stdout)
sys.stderr = codecs.getwriter('utf8')(sys.stderr)

OAUTH_KEY = "xxxxxxxxxxxxxxxxxxx"
repos = ['my-repo']

# List pull request
def list_pr():      
    for repo in repos:
        r = requests.get('https://api.github.com/repos/owner/%s/pulls' % repo, 
auth=('token', OAUTH_KEY))
        data = r.json()

        for i in data:
            print "\nUser: " + i['user']['login'] + '\n' + "Number: " + 
str(i['number']) + '\n' + "Time created: " + i['created_at'] + '\n' + "Title: " 
+ i['title'] + '\n' + "Body: " + i['body'] + '\n'

list_pr()
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to