def do_execute_test(self,args): if args: from_hosts_filename, to_hosts_filename, result_filename = args.split(',') test_connection.test(from_hosts_filename, to_hosts_filename, result_filename) else: print "usage: execute_test from_host_filename, to_host_filename, result_filename"
urllib.FancyURLopener.prompt_user_passwd = lambda self, host, realm: (uname, password) def auth(): """The method to do HTTPBasicAuthentication""" opener = urllib.FancyURLopener() f = opener.open(_URL) feed = f.read() return feed color0 = "\033[0m" def readmail(feed, maxlen): """Parse the Atom feed and print a summary""" atom = feedparser.parse(feed) if 0 < len(atom.entries): color1 = "^fg(\#e66693)" else: color1 = "" print color1 + "%s" % (len(atom.entries)) if __name__ == "__main__": if test_connection.test() == True: f = auth() # Do auth and then get the feed readmail(f, int(maxlen)) # Let the feed be chewed by feedparser else: print "??"