#!/usr/bin/python import pythonwhois import argparse import sys parser = argparse.ArgumentParser(description='Check whois and dns information.') parser.add_argument('--domain', nargs=1, required=True, help='the domain name') parser.add_argument('--nameserver', nargs='*', help='a space delimited list of nameservers') args = parser.parse_args() try: domain = pythonwhois.get_whois(args.domain[0]) except: #something happened, raise an erro print "3 Unexpected error: ", sys.exc_info()[0]