Closed baigreen closed 1 year ago
these issue change depending on your geolocation, in fact this domain produces no real output at all for me (after the redirect to china)
python-whois]$ python
Python 3.11.2 (main, Feb 8 2023, 00:00:00) [GCC 12.2.1 20221121 (Red Hat 12.2.1-4)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import whois
>>> d = whois.query("web3gpt.com")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/mboot/DEV/00-github.com/mboot/python-whois/whois/__init__.py", line 297, in query
data = do_parse(
^^^^^^^^^
File "/home/mboot/DEV/00-github.com/mboot/python-whois/whois/_2_parse.py", line 260, in do_parse
return handleShortResponse(tld, dl, whois_str, verbose)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/mboot/DEV/00-github.com/mboot/python-whois/whois/_2_parse.py", line 163, in handleShortResponse
raise FailedParsingWhoisOutput(whois_str)
whois.exceptions.FailedParsingWhoisOutput: [Querying whois.verisign-grs.com]
[Redirected to whois.22.cn]
[Querying whois.22.cn]
[whois.22.cn]
we actually use a try: block
https://github.com/DannyCork/python-whois/blob/master/whois/_1_query.py#L182
what would you prefer in this case, a simple None response without any cause or should we add something like the whois.query() returns None and a additional call like last_status could return:
FailedParsingWhoisOutput (in my case) or WhoisCommandFailed (in your case)
in my test2.py program i use:
try:
testItem(d)
except whois.UnknownTld as e:
errorItem(d, e, what="UnknownTld")
except whois.FailedParsingWhoisOutput as e:
errorItem(d, e, what="FailedParsingWhoisOutput")
except whois.UnknownDateFormat as e:
errorItem(d, e, what="UnknownDateFormat")
except whois.WhoisCommandFailed as e:
errorItem(d, e, what="WhoisCommandFailed")
except whois.WhoisQuotaExceeded as e:
errorItem(d, e, what="WhoisQuotaExceeded")
except whois.WhoisPrivateRegistry as e:
errorItem(d, e, what="WhoisPrivateRegistry")
except whois.WhoisCommandTimeout as e:
errorItem(d, e, what="WhoisCommandTimeout")
I am not sure. In my opinion, the service for getting basic information should be stable.
For .com, I think the first step is
whois -h whois.verisign-grs.com web3gpt.com
to get the basic information, and the second step is
whois -h whois.22.cn web3gpt.com
Even if the second step fails, it should return the main information already obtained in the first step.
Well that happens all inside the cli whois command and is different on mac then on linux. on Mac the cli whois has a tendency to show all steps of the redirect, on Linux the cli whois only shows the final redirect result.
I have no influence on the behavior of how the cli whois does its work, all we can do is ignore the error code of whois and do our best to parse the result if there is any, for the ignore error code we already have a option on whois.query
example with your command above (on linux fedora 37):
whois -h whois.verisign-grs.com web3gpt.com
[Querying whois.verisign-grs.com]
[Redirected to whois.22.cn]
[Querying whois.22.cn]
[whois.22.cn]
whois -h whois.22.cn web3gpt.com
[Querying whois.22.cn]
[whois.22.cn]
Will close it.