Skip to content

Commit

Permalink
version 1.20230913.1
Browse files Browse the repository at this point in the history
  • Loading branch information
mboot-github committed Sep 13, 2023
1 parent 32fb2aa commit 3408f68
Show file tree
Hide file tree
Showing 8 changed files with 35 additions and 6 deletions.
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -214,3 +214,6 @@ cleanDist:
zz:
docker build -t df36 -f Df-36 .
docker run -v .:/context df36 -d google.com

withPublicSuffix:
./test2.py -d www.dublin.airport.aero --withPublicSuffix
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,3 +77,8 @@ and `make suggest`.
* allow contextual search in splitted data and plain data
* allow contextual search based on earlier result
* fix a few tld to return the proper registrant string (not nic handle)

### 1.20230913.1
* if you have installed `tld` (pip install tld) you can enable withPublicSuffix=True to process untill you reach the pseudo tld.
* the public_suffix info is added if available (and if requested)
* example case is: ./test2.py -d www.dublin.airport.aero --withPublicSuffix
11 changes: 9 additions & 2 deletions tests/test-google-tld.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,10 @@ def getOneRegistrant(
) -> None:
try:
print(f"\n### ===: try: {domain}")
w = whoisdomain.query(domain)
w = whoisdomain.query(
domain,
withPublicSuffix=True,
)
except Exception as e:
print(domain, e, file=sys.stderr)
print(whoisdomain.get_last_raw_whois_data())
Expand Down Expand Up @@ -67,7 +70,11 @@ def xMain() -> None:
registrants: Dict[str | None, List[str]] = {}

for domain in domains:
getOneRegistrant(domain, registrants, verbose)
getOneRegistrant(
domain,
registrants,
verbose,
)

ll = cast(List[str], registrants.keys())
for k in sorted(ll):
Expand Down
6 changes: 6 additions & 0 deletions whoisdomain/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,9 @@ def query(
simplistic: bool = False,
withRedacted: bool = False,
pc: Optional[ParameterContext] = None,
tryInstallMissingWhoisOnWindows: bool = False,
shortResponseLen: int = 5,
withPublicSuffix: bool = False,
# if you use pc as argument all above params (except domain are ignored)
) -> Optional[Domain]:
# see documentation about paramaters in parameterContext.py
Expand All @@ -217,6 +220,9 @@ def query(
cmd=cmd,
simplistic=simplistic,
withRedacted=withRedacted,
withPublicSuffix=withPublicSuffix,
shortResponseLen=shortResponseLen,
tryInstallMissingWhoisOnWindows=tryInstallMissingWhoisOnWindows,
)

if verbose:
Expand Down
10 changes: 9 additions & 1 deletion whoisdomain/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
IgnoreReturncode: bool = False
TestAllTld: bool = False
TestRunOnly: bool = False
WithPublicSuffix: bool = False


class ResponseCleaner:
Expand Down Expand Up @@ -215,6 +216,7 @@ def testItem(

global TestAllTld
global TestRunOnly
global WithPublicSuffix

pc = whois.ParameterContext(
ignore_returncode=IgnoreReturncode,
Expand All @@ -223,7 +225,7 @@ def testItem(
include_raw_whois_text=PrintGetRawWhoisResult,
simplistic=SIMPLISTIC,
withRedacted=WithRedacted,
withPublicSuffix=True, # temp
withPublicSuffix=WithPublicSuffix,
)

# use the new query (can also simply use q2()
Expand Down Expand Up @@ -530,6 +532,8 @@ def main() -> None:
global WithRedacted
global TestAllTld
global TestRunOnly
global WithPublicSuffix

name: str = os.path.basename(sys.argv[0])
if name == "test2.py":
SIMPLISTIC = False
Expand Down Expand Up @@ -558,6 +562,7 @@ def main() -> None:
"having=",
"Cleanup=",
"withRedacted",
"withPublicSuffix",
],
)
except getopt.GetoptError:
Expand Down Expand Up @@ -597,6 +602,9 @@ def main() -> None:
if opt in ("--withRedacted"):
WithRedacted = True

if opt in ("--withPublicSuffix"):
WithPublicSuffix = True

if opt in ("-a", "--all"):
TestAllTld = True

Expand Down
2 changes: 1 addition & 1 deletion whoisdomain/processWhoisDomainRequest.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def _internationalizedDomainNameToPunyCode(d: List[str]) -> List[str]:
self.dc.domain = self.dc.domain.lower().strip().rstrip(".") # Remove the trailing dot to support FQDN.
self.dc.dList = self.dc.domain.split(".")

# test with: www.dublin.airport.aero
# test with: www.dublin.airport.aero see make withPublicSuffix
if self.dc.hasLibTld and self.pc.withPublicSuffix:
res = libTld.get_tld(
self.dc.domain,
Expand Down
2 changes: 1 addition & 1 deletion whoisdomain/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
VERSION = "1.20230906.1"
VERSION = "1.20230913.1"
2 changes: 1 addition & 1 deletion work/version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.20230906.1
1.20230913.1

0 comments on commit 3408f68

Please sign in to comment.