davanand.bahall at gmail.com
Mon Aug 24 22:14:03 CEST 2015
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?
sys.stdout = codecs.getwriter('utf8')(sys.stdout)
sys.stderr = codecs.getwriter('utf8')(sys.stderr)
OAUTH_KEY = "xxxxxxxxxxxxxxxxxxx"
repos = ['my-repo']
# List pull request
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'
More information about the Python-list