Skip to content

Commit

Permalink
get_commits.py: grab github username info with github API
Browse files Browse the repository at this point in the history
  • Loading branch information
eminence committed May 17, 2016
1 parent 520b9e2 commit 4416c5d
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion tools/get_commits.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
import time
from datetime import datetime,timedelta
from pprint import pprint
import urllib2
import json

name_map = {
('Jeromy', 'jeromyj@gmail.com'): 'Jeromy Johnson',
Expand Down Expand Up @@ -79,7 +81,15 @@ def main(repo_path, start, end):

print "\nContributors for this period (%s to %s):" % (start.isoformat(), end.isoformat())
for a in sorted(authors):
print "*", a, "https://github.com/ipfs/%s/commit/%s" % author_repo_map[a]
try:
f = urllib2.urlopen("https://api.github.com/repos/ipfs/%s/commits/%s" % author_repo_map[a])
js = json.load(f)
# example:
# @eminence (Andrew Chin)
# [@githubname](githuburl) (author_name)
print "* [@%s](%s) (%s)" % (js['author']['login'], js['author']['html_url'], js['commit']['author']['name'])
except:
print "*", a, "https://github.com/ipfs/%s/commit/%s" % author_repo_map[a]
print ""


Expand Down

0 comments on commit 4416c5d

Please sign in to comment.