Created
April 17, 2009 07:40
-
-
Save svetlyak40wt/96909 to your computer and use it in GitHub Desktop.
Simple script to collect GitHub stats about user's repositories.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import sys | |
from lxml import etree as ET | |
username = 'svetlyak40wt' | |
if len(sys.argv) == 2: | |
username = sys.argv[1] | |
url = 'http://github.com/api/v1/xml/%s' % username | |
data = ET.parse(url) | |
reps = data.findall('repositories/repository') | |
if reps: | |
tmpl = '%25s, %8s, %5s' | |
print tmpl % ('NAME', 'WATCHERS', 'FORKS') | |
for rep in reps: | |
print tmpl % ( | |
rep.find('name').text, | |
rep.find('watchers').text, | |
rep.find('forks').text, | |
) | |
else: | |
print 'User %s has no repositories.' % username |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment