#NEWLINE# def get_whois_data( domain ) : #NEWLINE# #INDENT# domain = domain . replace ( 'http://' , '' ) #NEWLINE# domain = domain . replace ( 'www.' , '' ) #NEWLINE# ext = domain [ ( - 3 ) : ] #NEWLINE# if ( ( ext == 'com' ) or ( ext == 'org' ) or ( ext == 'net' ) ) : #NEWLINE# #INDENT# whois = 'whois.internic.net' #NEWLINE# msg = perform_whois ( whois , domain ) #NEWLINE# lines = msg . splitlines ( ) #NEWLINE# for line in lines : #NEWLINE# #INDENT# if ( ':' in line ) : #NEWLINE# #INDENT# words = line . split ( ':' ) #NEWLINE# if ( ( 'Whois' in words [ 0 ] ) and ( 'whois.' in words [ 1 ] ) ) : #NEWLINE# #INDENT# whois = words [ 1 ] . strip ( ) #NEWLINE# break #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# ext = domain . split ( '.' ) [ ( - 1 ) ] #NEWLINE# whois = 'whois.iana.org' #NEWLINE# msg = perform_whois ( whois , ext ) #NEWLINE# lines = msg . splitlines ( ) #NEWLINE# for line in lines : #NEWLINE# #INDENT# if ( ':' in line ) : #NEWLINE# #INDENT# words = line . split ( ':' ) #NEWLINE# if ( ( 'whois.' in words [ 1 ] ) and ( 'Whois Server (port 43)' in words [ 0 ] ) ) : #NEWLINE# #INDENT# whois = words [ 1 ] . strip ( ) #NEWLINE# break #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# msg = perform_whois ( whois , domain ) #NEWLINE# return msg