whois/whois.py
changeset 65 50b5966b5566
parent 64 2ed54e885571
child 70 1fe2c20adeba
child 80 fa9650e9ec23
equal deleted inserted replaced
64:2ed54e885571 65:50b5966b5566
   120                 if not d:
   120                 if not d:
   121                     break
   121                     break
   122             s.close()
   122             s.close()
   123         except socket.error as socketerror:
   123         except socket.error as socketerror:
   124             print 'Socket Error:', socketerror
   124             print 'Socket Error:', socketerror
   125         nhost = None
   125             return ''
   126         response = enforce_ascii(response)
   126         else:
   127         if 'with "=xxx"' in response:
   127             nhost = None
   128             return self.whois(query, hostname, flags, True)
   128             response = enforce_ascii(response)
   129         if flags & NICClient.WHOIS_RECURSE and nhost is None:
   129             if 'with "=xxx"' in response:
   130             nhost = self.findwhois_server(response.decode(), hostname, query)
   130                 return self.whois(query, hostname, flags, True)
   131         if nhost is not None:
   131             if flags & NICClient.WHOIS_RECURSE and nhost is None:
   132             response += self.whois(query, nhost, 0)
   132                 nhost = self.findwhois_server(response.decode(), hostname, query)
   133         return response.decode()
   133             if nhost is not None:
       
   134                 response += self.whois(query, nhost, 0)
       
   135             return response.decode()
   134 
   136 
   135     def choose_server(self, domain):
   137     def choose_server(self, domain):
   136         """Choose initial lookup NIC host"""
   138         """Choose initial lookup NIC host"""
   137         if type(domain) is not unicode:
   139         if type(domain) is not unicode:
   138             domain = domain.decode('utf-8').encode('idna')
   140             domain = domain.decode('utf-8').encode('idna')