Skip to content

Instantly share code, notes, and snippets.

@bryanveloso
Forked from jeremyBanks/ghapitest.py
Created August 27, 2008 05:44
Show Gist options
  • Save bryanveloso/7432 to your computer and use it in GitHub Desktop.
Save bryanveloso/7432 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
# encoding: utf-8
import demjson
from pprint import pprint
import urllib2
def main():
user = "jeremybanks"
userJSON = urllib2.urlopen("http://github.com/api/v1/json/%s/" % user).read()
user = demjson.decode(userJSON)["user"]
print("Latest Commits In %(name)s's Repositories' Master Branches:\n" % user)
for repository in user["repositories"]:
masterHeadJSON = urllib2.urlopen("http://github.com/api/v1/json/%(owner)s/%(name)s/commit/master" % repository).read()
masterHead = demjson.decode(masterHeadJSON)["commit"]
masterHead["author"] = "%(name)s <%(email)s>" % masterHead["author"]
masterHead["message"],t,t = masterHead["message"].partition("\n")
print("%(id)s\n%(author)s\n%(message)s\n" % masterHead)
if __name__ == "__main__": sys.exit(main())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment