Skip to content

Instantly share code, notes, and snippets.

@svetlyak40wt
Created April 17, 2009 07:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save svetlyak40wt/96909 to your computer and use it in GitHub Desktop.
Save svetlyak40wt/96909 to your computer and use it in GitHub Desktop.
Simple script to collect GitHub stats about user's repositories.
#!/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