whois/whois.py
changeset 64 2ed54e885571
parent 62 fc06c601b875
child 65 50b5966b5566
--- a/whois/whois.py	Tue Sep 08 11:09:27 2015 +0800
+++ b/whois/whois.py	Mon Sep 14 15:13:50 2015 +0100
@@ -90,7 +90,7 @@
                     break
         return nhost
 
-    def whois(self, query, hostname, flags):
+    def whois(self, query, hostname, flags, many_results=False):
         """Perform initial lookup with TLD whois server
         then, if the quick flag is false, search that result
         for the region-specifc whois server and do a lookup
@@ -107,7 +107,7 @@
 
             if hostname == NICClient.DENICHOST:
                 queryBytes = "-T dn,ace -C UTF-8 " + query
-            elif hostname.endswith(NICClient.QNICHOST_TAIL):
+            elif hostname.endswith(NICClient.QNICHOST_TAIL) and many_results:
                 queryBytes = '=' + query
             else:
                 queryBytes = query
@@ -121,9 +121,11 @@
                     break
             s.close()
         except socket.error as socketerror:
-            print 'Error: ', socketerror
+            print 'Socket Error:', socketerror
         nhost = None
         response = enforce_ascii(response)
+        if 'with "=xxx"' in response:
+            return self.whois(query, hostname, flags, True)
         if flags & NICClient.WHOIS_RECURSE and nhost is None:
             nhost = self.findwhois_server(response.decode(), hostname, query)
         if nhost is not None: