#!/usr/bin/env python2 import urllib import sys import re from BeautifulSoup import BeautifulSoup def usage(): print(""" **Retirement script** v0.1 2011-05-23 Markos Chandras Developed for Gentoo Linux Undertaker Project usage: ./retstats : The developer you are looking for : Your bugzilla username : Your bugzilla password Your credentials are required when searching bugzilla history. If you want to avoid using your credentials over and over you can hardcode them by opening the script and adjusting the "username" and "password" variables as appropriate. """) def main(): try: args = sys.argv except getopt.GetoptError, err: print(str(err)) if len(args) != 4: usage() sys.exit(1) # Save arguments # user = args[2]+"@gentoo.org" password = args[3] dev = args[1] # Handle CIA.vc print("\n----Activity Results -----") string = "http://cia.vc/stats/author/"+dev+"/.rss" url=urllib.urlopen(string) devinfo = url.read() data = BeautifulSoup(devinfo) data=data.find("pubdate") final=str(data).replace("",'').replace("+0000",'').replace("",'') # Handle Bugzie string = "http://bugs.gentoo.org/custom_userhistory.cgi?matchstr="+dev+"@gentoo.org" # bugzie requires login p = urllib.urlencode( { 'Bugzilla_login': user, 'Bugzilla_password': password} ) url = urllib.urlopen(string,p) devinfo = url.read() data = BeautifulSoup(devinfo) data=str(data).split("
") pattern = re.compile(r'(\d+\-\d+\-\d+)') top=pattern.search(data[1]) # Output print("developer: "+dev) print("cia.vc : "+final) print("Bugzie : "+top.group(0)) # Main if __name__ == "__main__": main()