Home > Enterprise >  Get commiters in a repo using Github API
Get commiters in a repo using Github API

Time:03-25

I am using PyGithub to develop a proyect with networkx that creates graphs taking all the contributors in some repos and using them as nodes. However, I am not able to get the commiters from a repo using that library. Is there a way to get the commiters? help is much appreciated

code that I have:

from github import Github
import networkx as nx



def make_graph(commiters):
    G = nx.complete_graph(commiters)
    return G

def merge_graphs(G1, G2):
    G = nx.complete_graph(G1.nodes()   G2.nodes())

token = (token)
g = Github(token)


for repo in g.get_user('user').get_repos():
   print(repo.name)
   repo.edit(has_wiki=False)

CodePudding user response:

According to the PyGithub docs you need to use get_contributors method:

repo.get_contributors()
  • Related