44import re
55import getopt
66import sys
7+ import json
78
89Verbose = False
910Failures = {}
1011IgnoreReturncode = False
1112
1213
1314def prepItem(d):
14- print("-" * 80 )
15- print(d )
15+ print("" )
16+ print(f"test domain: <<<<<<<<<< {d} >>>>>>>>>>>>>>>>>>>>" )
1617
18+ def xType(x):
19+ s = f"{type(x)}"
20+ return s.split("'")[1]
1721
1822def testItem(d):
1923 w = whois.query(
@@ -27,9 +31,21 @@ def testItem(d):
2731 print("None")
2832 return
2933
34+ # the 3 date time items can be None if not present or a datetime string
35+ # dnssec is a bool
36+ # some strings are return as '' when empty (status)
37+ # statuses can be a array of one empty string if no data
38+
39+ # not all values are always present it mainly depends on whet we see in the output of whois
40+ # if we return not None: the elements that ars always there ars domain_name and tld
41+
3042 wd = w.__dict__
3143 for k, v in wd.items():
32- print('%20s\t"%s"' % (k, v))
44+ ss = "%-18s %-17s "
45+ if isinstance(v, str):
46+ print((ss + "'%s'") % (k, xType(v), v))
47+ else:
48+ print((ss + "%s") % (k, xType(v), v))
3349
3450
3551def errorItem(d, e, what="Generic"):
@@ -74,8 +90,8 @@ def testDomains(aList):
7490 errorItem(d, e, what="WhoisQuotaExceeded")
7591 except whois.WhoisPrivateRegistry as e:
7692 errorItem(d, e, what="WhoisPrivateRegistry")
77- except Exception as e:
78- errorItem(d, e, what="Generic")
93+ # except Exception as e:
94+ # errorItem(d, e, what="Generic")
7995
8096
8197def getTestFileOne(fPath, fileData):
0 commit comments