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

Commit 7569da7

Browse files
committed
rework test2 to show type of var and show emptry string as ''
1 parent 7de8b2e commit 7569da7

File tree

3 files changed

+22
-7
lines changed

3 files changed

+22
-7
lines changed

test2.py

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,20 @@
44
import re
55
import getopt
66
import sys
7+
import json
78

89
Verbose = False
910
Failures = {}
1011
IgnoreReturncode = False
1112

1213

1314
def 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

1822
def 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

3551
def 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

8197
def getTestFileOne(fPath, fileData):

whois/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@
4848
Map2Underscore = {
4949
".ac.uk": "ac_uk",
5050
".co.uk": "co_uk",
51-
5251
".co.il": "co_il",
5352
# uganda
5453
".ca.ug": "ca_ug",

whois/tld_regexpr.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@
115115
au = {
116116
"extend": "com",
117117
"registrar": r"Registrar Name:\s?(.+)",
118-
"updated_date": r"Last Modified:([^\n]*)", # fix empty LastModified
118+
"updated_date": r"Last Modified:([^\n]*)", # fix empty LastModified
119119
}
120120

121121
ax = {

0 commit comments

Comments
 (0)