Code Monkey home page Code Monkey logo

Comments (6)

maarten-boot avatar maarten-boot commented on June 20, 2024

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]

from python-whois.

maarten-boot avatar maarten-boot commented on June 20, 2024

we actually use a try: block

https://github.com/DannyCork/python-whois/blob/master/whois/_1_query.py#L182

from python-whois.

maarten-boot avatar maarten-boot commented on June 20, 2024

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")
            ```
            

from python-whois.

baigreen avatar baigreen commented on June 20, 2024

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.

from python-whois.

maarten-boot avatar maarten-boot commented on June 20, 2024

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]

from python-whois.

baigreen avatar baigreen commented on June 20, 2024

#306 add a simple way to ignore the error.
Will close it.

from python-whois.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.