--- a/whois/__init__.py Fri Jan 20 15:25:04 2017 +0800
+++ b/whois/__init__.py Fri Jan 20 15:33:38 2017 +0800
@@ -14,6 +14,7 @@
from .whois import NICClient
+
def whois(url, command=False):
# clean domain to expose netloc
ip_match = re.match(r"^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$", url)
@@ -34,7 +35,7 @@
else:
# try builtin client
nic_client = NICClient()
- text = nic_client.whois_lookup(None, domain, 0)
+ text = nic_client.whois_lookup(None, domain.encode('idna'), 0)
return WhoisEntry.load(domain, text)
--- a/whois/whois.py Fri Jan 20 15:25:04 2017 +0800
+++ b/whois/whois.py Fri Jan 20 15:33:38 2017 +0800
@@ -86,6 +86,7 @@
break
return nhost
+
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
@@ -108,10 +109,10 @@
if hostname == NICClient.DENICHOST:
query_bytes = "-T dn,ace -C UTF-8 " + query
elif hostname.endswith(NICClient.QNICHOST_TAIL) and many_results:
- query_bytes = '=' + query
+ query_bytes = '='
else:
query_bytes = query
- s.send((query_bytes).encode('idna') + b"\r\n")
+ s.send((query_bytes) + b"\r\n")
# recv returns bytes
while True:
d = s.recv(4096)