Skip to content

Commit

Permalink
Fix server check for query
Browse files Browse the repository at this point in the history
  • Loading branch information
pogzyb committed Nov 4, 2024
1 parent 6d6397c commit 003e95a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion asyncwhois/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ def _do_query(
whois_server
and whois_server != server
and not whois_server.startswith("http")
and not whois_server.startswith("www.")
):
# recursive call to find more authoritative server
chain = self._do_query(
Expand All @@ -173,10 +174,12 @@ async def _aio_do_query(
# parse response for the referred WHOIS server name
whois_server = self._find_match(regex, query_output)
whois_server = whois_server.lower()
# check for another legitimate server name
if (
whois_server
and whois_server != server
and not whois_server.startswith("http")
and not whois_server.startswith("www.")
):
# recursive call to find the authoritative server
chain = await self._aio_do_query(
Expand All @@ -197,7 +200,8 @@ def __init__(
self.server = server

@staticmethod
def _get_server_name(tld: str) -> Union[str, None]:
def _get_server_name(domain_name: str) -> Union[str, None]:
tld = domain_name.split(".")[-1]
tld_converted = tld.upper().replace("-", "_")
for servers in [CountryCodeTLD, GenericTLD, SponsoredTLD]:
if hasattr(servers, tld_converted):
Expand Down

0 comments on commit 003e95a

Please sign in to comment.