# HG changeset patch # User joan # Date 1511654643 -3600 # Node ID 30259bf0523feac2158f78a59211b3c5b28bcc33 # Parent 808c8bc803f5c140e195271cf662e7a1692525f1 Fixes for python 3.6 diff -r 808c8bc803f5 -r 30259bf0523f whois/__init__.py --- a/whois/__init__.py Tue Oct 24 15:23:48 2017 +0300 +++ b/whois/__init__.py Sun Nov 26 01:04:03 2017 +0100 @@ -73,7 +73,7 @@ if not suffixes: # downloaded from https://publicsuffix.org/list/public_suffix_list.dat tlds_path = os.path.join(os.getcwd(), os.path.dirname(__file__), 'data', 'public_suffix_list.dat') - with open(tlds_path) as tlds_fp: + with open(tlds_path, encoding='utf-8') as tlds_fp: suffixes = set(line.encode('utf-8') for line in tlds_fp.read().splitlines() if line and not line.startswith('//')) if not isinstance(url, str): @@ -85,7 +85,7 @@ domain = b'' for section in reversed(url.split(b'.')): if domain: - domain = '.' + domain + domain = b'.' + domain domain = section + domain if domain not in suffixes: break diff -r 808c8bc803f5 -r 30259bf0523f whois/whois.py --- a/whois/whois.py Tue Oct 24 15:23:48 2017 +0300 +++ b/whois/whois.py Sun Nov 26 01:04:03 2017 +0100 @@ -115,7 +115,7 @@ query_bytes = '=' + query else: query_bytes = query - s.send((query_bytes) + b"\r\n") + s.send(bytes(query_bytes,'utf-8') + b"\r\n") # recv returns bytes while True: d = s.recv(4096) @@ -142,6 +142,8 @@ domain = domain.encode('idna').decode('utf-8') except TypeError: domain = domain.decode('utf-8').encode('idna').decode('utf-8') + except AttributeError: + domain = domain.decode('utf-8').encode('idna').decode('utf-8') if domain.endswith("-NORID"): return NICClient.NORIDHOST if domain.endswith("id"):