whois/__init__.py
changeset 158 bcae8cb61002
parent 140 196df98347d8
equal deleted inserted replaced
157:f091b6581d21 158:bcae8cb61002
    31     else:
    31     else:
    32         domain = extract_domain(url)
    32         domain = extract_domain(url)
    33     if command:
    33     if command:
    34         # try native whois command
    34         # try native whois command
    35         r = subprocess.Popen(['whois', domain], stdout=subprocess.PIPE)
    35         r = subprocess.Popen(['whois', domain], stdout=subprocess.PIPE)
    36         text = r.stdout.read()
    36         text = r.stdout.read().decode()
    37     else:
    37     else:
    38         # try builtin client
    38         # try builtin client
    39         nic_client = NICClient()
    39         nic_client = NICClient()
    40         text = nic_client.whois_lookup(None, domain.encode('idna'), 0)
    40         text = nic_client.whois_lookup(None, domain.encode('idna'), 0)
    41     return WhoisEntry.load(domain, text)
    41     return WhoisEntry.load(domain, text)