GitHub user's stats

Published at 17, April 2009, author art. Tags: git, python

Today I wrote a simple python script, which uses GitHub's API, to retrive information about user's projects and their watchers/forkers count.

The script is pretty simple and uses lxml to get and parse XML page:

#!/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

Feel free to fork this Gist and modify it.

By the way, after work was done, I've found that Gabriel Horner already done same task few weeks ago, but he implemented it as a bookmarklet.

Using these tools, I found, the top 5 of my most popular apps:

Not bad! :-)

Pingbacks

permalink

17, April 2009, pingback from http://dev.bec.com.eg/wordpress/?p=2853:

Read the original:  GitHub user's stats — Lazy Crazy Coder's blog

Comments

Subscribe on this post's comments

No comments. Wanna be first?

First, identify yourself and come back to leave comments.

If you wish to leave comment, please, identify yourself and then come back to this page.