#!/usr/bin/pythonfrom ConfigParser import ConfigParserfrom urllib import FancyURLopenerimport osimport redef checkConfig(): config=ConfigParser() if config.read(os.path.expanduser('~/.fever')) == []: print "Config file does not exist.\nPlease create it." raise SystemExit, 1 for section in config.sections(): if 'site' and 'filename' not in config.options(section): print '%s section is incorrect.\nYou have to add "site" or "filename" option."' % section raise SystemExit, 1 print 'Checking %s' % section file=download(config.get(section,'site')) reg=re.compile(config.get(section,'filename')) search=reg.findall(file) search.sort() print 'The newest version of %s is %s' % (section,search[search.__len__()-1])def download(address): url=FancyURLopener() file=url.open(address).read() return fileif __name__ == "__main__": checkConfig()