How to list repository contributors and their commits using pygithub3 - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: Data Science (https://python-forum.io/forum-44.html) +--- Thread: How to list repository contributors and their commits using pygithub3 (/thread-1989.html) |
How to list repository contributors and their commits using pygithub3 - ammarkhwaira - Feb-09-2017 I have a Github user in which I have been granted the access to see an organization called 'W-Org' with all its repositories. It has repo-A and repo-B. If I click on W-Org and navigate to repo-A, then click on 'Graphs', I can see each contributor to this repo-A with his commits (no of commits, lines added, lines removed). How can I write python code using pygithub3 to get into this? All what I could get is a list of repositories for this org using: gr = gh.repos.list_by_org('W-Org',type='all').all()and a list of all contributors (not linked to each repo) using: gh.orgs.members.list('W-Org').all()How to link this repository with the contributor and then get his commits? I also tried this code, but it gives me 'Not found 404!' although I can see and click on repo-A and see its contents. gh.repos.commits.list('repo-A').all() RE: How to list repository contributors and their commits using pygithub3 - Larz60+ - Feb-09-2017 Show enough code to make a runable snippet RE: How to list repository contributors and their commits using pygithub3 - ammarkhwaira - Feb-09-2017 Hi below is the code i wrote, if you want to run it, you will need to use your Github user and password instead of mine. Thank you. import numpy as np import pandas as pd from pandas import Series, DataFrame from pygithub3 import Github import ConfigParser config = ConfigParser.ConfigParser() config.read("/etc/ammar_config.txt") pass_secret = config.get("configuration","password") gh = Github(user='ammar-khwaireh', token=pass_secret) # get org repositories gr = gh.repos.list_by_org('W-Org',type='all').all() contributors = gh.orgs.members.list('W-Org').all() commits = gh.repos.commits.list(repo='repo-A').all() RE: How to list repository contributors and their commits using pygithub3 - Larz60+ - Feb-09-2017 Quote:How can I write python code using pygithub3 to get into this?I think this is what you are looking for https://developer.github.com/v3/pulls/ RE: How to list repository contributors and their commits using pygithub3 - ammarkhwaira - Feb-09-2017 Thanks for your reply. Actually pygithub3 is a wrapper for github API ( the link you have sent) written in python. The code snippet i have written above is calling this API. but my issue here is how to write code in pygithub3 using python to call github API to get the repository contributors' commits. i mean, looping through org repositories, loop through repository contributors, and get their commits. thanks RE: How to list repository contributors and their commits using pygithub3 - Larz60+ - Feb-09-2017 I know that. But you are using that wrapper, and the (pygithub3) pull command is part of the wrapper which you are already using! (gh) RE: How to list repository contributors and their commits using pygithub3 - ammarkhwaira - Feb-12-2017 Do you have python code which can pull repository statistics using pygithub3 ? (github API in this link https://developer.github.com/v3/repos/statistics/#get-contributors-list-with-additions-deletions-and-commit-counts) |