whois/whois.py
changeset 122 95feee1af1da
parent 112 8acab8765146
child 123 03c72d0d1182
equal deleted inserted replaced
121:ccd653a54263 122:95feee1af1da
    84                 if buf.find(nichost) != -1:
    84                 if buf.find(nichost) != -1:
    85                     nhost = nichost
    85                     nhost = nichost
    86                     break
    86                     break
    87         return nhost
    87         return nhost
    88 
    88 
       
    89 
    89     def whois(self, query, hostname, flags, many_results=False):
    90     def whois(self, query, hostname, flags, many_results=False):
    90         """Perform initial lookup with TLD whois server
    91         """Perform initial lookup with TLD whois server
    91         then, if the quick flag is false, search that result
    92         then, if the quick flag is false, search that result
    92         for the region-specifc whois server and do a lookup
    93         for the region-specifc whois server and do a lookup
    93         there for contact details
    94         there for contact details
   106                 pass  # Already Unicode (python3's error)
   107                 pass  # Already Unicode (python3's error)
   107 
   108 
   108             if hostname == NICClient.DENICHOST:
   109             if hostname == NICClient.DENICHOST:
   109                 query_bytes = "-T dn,ace -C UTF-8 " + query
   110                 query_bytes = "-T dn,ace -C UTF-8 " + query
   110             elif hostname.endswith(NICClient.QNICHOST_TAIL) and many_results:
   111             elif hostname.endswith(NICClient.QNICHOST_TAIL) and many_results:
   111                 query_bytes = '=' + query
   112                 query_bytes = '='
   112             else:
   113             else:
   113                 query_bytes = query
   114                 query_bytes = query
   114             s.send((query_bytes).encode('idna') + b"\r\n")
   115             s.send((query_bytes) + b"\r\n")
   115             # recv returns bytes
   116             # recv returns bytes
   116             while True:
   117             while True:
   117                 d = s.recv(4096)
   118                 d = s.recv(4096)
   118                 response += d
   119                 response += d
   119                 if not d:
   120                 if not d: