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

Commit dd14d5b

Browse files
committed
print body in sections
1 parent 6791a5b commit dd14d5b

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

test2.py

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,6 @@ def showAllCurrentTld():
156156

157157
def ShowRuleset(tld):
158158
rr = whois.TLD_RE
159-
160159
if tld in rr:
161160
for key in sorted(rr[tld].keys()):
162161
rule = f"{rr[tld][key]}"
@@ -214,19 +213,14 @@ def splitBodyInSections(body: List) -> List:
214213
sections[m] = cleanSection(sections[m])
215214
m += 1
216215

217-
# print(sections)
218-
# print(len(sections))
219-
220216
# now remove ampty sections and return
221217
sections2 = []
222218
m = 0
223219
while m < len(sections):
224-
print(m, len(sections[m]))
225220
if len(sections[m]) > 0:
226221
sections2.append(sections[m])
227222
m += 1
228223

229-
# print(sections2)
230224
return sections2
231225

232226

@@ -292,9 +286,8 @@ def cleanupWhoisResponse(
292286
rr.append(line)
293287

294288
body = cleanSection(body)
295-
sections = splitBodyInSections(body)
296-
rDict["Body"] = sections
297-
return "\n".join(rr), rDict["Body"]
289+
rDict["Body"] = splitBodyInSections(body)
290+
return "\n".join(rr), rDict
298291

299292

300293
def usage():
@@ -465,6 +458,15 @@ def main(argv):
465458
print(d1) # the data without pre and postamble or percent section
466459
print(rDict)
467460

461+
k = "Body"
462+
if len(rDict[k]):
463+
n = 0
464+
for section in rDict[k]:
465+
print(f"# ------------- {k} Section: {n} ----------------------")
466+
n += 1
467+
for line in section:
468+
print(line)
469+
468470
sys.exit(0)
469471

470472
if opt in ("-f", "--file"):

0 commit comments

Comments
 (0)