In [2]:
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
%matplotlib inline
In [3]:
from github import Github #http://jacquev6.net/PyGithub/v1/introduction.html
In [4]:
import os
user = os.environ['GITHUB_USER']
token = os.environ['GITHUB_TOKEN']
password = os.environ['GITHUB_PASSWORD']
In [5]:
g = Github(token)
In [6]:
print g.rate_limiting
from datetime import datetime
print datetime.fromtimestamp(g.rate_limiting_resettime)
We use :
In [7]:
users = ["pocman", "callicles", "jacobtardieu", "sheymann"]
searched_users = [g.search_users(u) for u in users]
get_users = [g.get_user(u) for u in users]
In [8]:
for u in get_users:
print "_________%s_________" % u.name
for r in u.get_repos():
print r.full_name
In [9]:
get_repos = { u.login : u.get_repos() for u in get_users }
we use:
In [19]:
import time
for user, repos in get_repos.items():
print "_________%s______" % user
for code in g.search_code("bootstrap user:%s" % user):
print code.name
Some stats about user's repos
In [83]:
for u, repos in get_repos.items():
print "_______%s______", u
for r in repos:
print "forked: %s ------ starts: %d" % (r.fork, r.stargazers_count)
We use the list of all contributors for every user's repo GET /repos/:owner/:repo/contributors
.
For each contributor, we can use GET /repos/:owner/:repo/stats/contributors
that will return line contribution for that user.
In [90]:
for u, repos in get_repos.items():
print "_______%s______" % u
for r in repos:
try:
contributions = [1 for c in r.get_contributors()]
print "forked: %s ------ contributors: %d" % (r.fork, len(contributions))
except TypeError:
print "forked: %s ------ contributors: 0" % r.fork
In [ ]: