Skip to content
This repository was archived by the owner on Feb 3, 2024. It is now read-only.

Commit 8ec8116

Browse files
author
MooCow
authored
Merge pull request #243 from FabrizioPeresson/master
Fix for Windows, list of test with 'None' result, server for AI TLD
2 parents 7ac6217 + 7081b96 commit 8ec8116

File tree

4 files changed

+29
-7
lines changed

4 files changed

+29
-7
lines changed

test.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
# OK NOW:
1616
# abroco.me
1717
# wp.pl
18+
# google.ai
1819
1920
# New TLD
2021
whois.aero
@@ -353,7 +354,7 @@
353354
"""
354355

355356
failure = {}
356-
357+
nones = []
357358

358359
def prepItem(d):
359360
print("-" * 80)
@@ -367,6 +368,7 @@ def testItem(d):
367368
for k, v in wd.items():
368369
print('%20s\t"%s"' % (k, v))
369370
else:
371+
nones.append(d)
370372
print("None")
371373

372374

@@ -451,11 +453,14 @@ def main():
451453
print("\n========================================\n")
452454
testDomains(UnknownDateFormat.split("\n"))
453455

454-
print(f"Failure during test : {len(failure)}")
455-
456456
print("\n# ========================")
457+
print(f"Failure during test : {len(failure)}")
457458
for i in sorted(failure.keys()):
458459
print(i, failure[i])
459460

461+
print("\n# ========================")
462+
print(f"Domains with 'None' result : {len(nones)}")
463+
for d in sorted(nones):
464+
print(d)
460465

461466
main()

whois/_1_query.py

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,9 +104,25 @@ def makeWhoisCommandToRun(
104104

105105
if platform.system() == "Windows":
106106
# Usage: whois [-v] domainname [whois.server]
107-
if not os.path.exists("whois.exe"):
108-
tryInstallMissingWhoisOnWindows(verbose)
109-
wh = r".\whois.exe "
107+
108+
if os.path.exists("whois.exe"):
109+
wh = r".\whois.exe "
110+
else:
111+
find = False
112+
paths = os.environ["path"].split(";")
113+
for path in paths:
114+
wpath = os.path.join(path, "whois.exe")
115+
if os.path.exists(wpath):
116+
wh = wpath
117+
find = True
118+
break
119+
120+
if not find:
121+
tryInstallMissingWhoisOnWindows(verbose)
122+
123+
if server:
124+
return [wh, "-v", "-nobanner", domain, server]
125+
return [wh, "-v", "-nobanner", domain]
110126

111127
if server:
112128
return [wh, domain, "-h", server]

whois/_2_parse.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ def cleanupWhoisResponse(
103103
if line.startswith("Terms of Use:"): # these lines contibute nothing so ignore
104104
continue
105105

106-
tmp2.append(line)
106+
tmp2.append(line.strip("\r"))
107107

108108
return "\n".join(tmp2)
109109

whois/tld_regexpr.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@
6363
# Anguilla
6464
ai = {
6565
"extend": "com",
66+
"_server": "whois.nic.ai",
6667
}
6768

6869
# Armenia

0 commit comments

Comments
 (0)