What Python way would you suggest to check whois database records?

前端 未结 9 1021
忘掉有多难
忘掉有多难 2020-12-31 18:20

I\'m trying to get a webservice up and running that actually requires to check whois databases. What I\'m doing right now is ugly and I\'d like to avoid it as much as I can:

9条回答
  •  梦毁少年i
    2020-12-31 18:36

    Found this question in the process of my own search for a python whois library.

    Don't know that I agree with cdleary's answer that using a library that wraps a command is always the best way to go - but I can see his reasons why he said this.

    Pro: cmd-line whois handles all the hard work (socket calls, parsing, etc)

    Con: not portable; module may not work depending on underlying whois command. Slower, since running a command and most likely shell in addition to whois command. Affected if not UNIX (Windows), different UNIX, older UNIX, or older whois command

    I am looking for a whois module that can handle whois IP lookups and I am not interested in coding my own whois client.

    Here are the modules that I (lightly) tried out and more information about it:

    pywhoisapi:

    • Home: http://code.google.com/p/pywhoisapi/
    • Design: REST client accessing ARIN whois REST service
    • Pros: Able to handle IP address lookups
    • Cons: Able to pull information from whois servers of other RIRs?

    BulkWhois

    • Home: http://pypi.python.org/pypi/BulkWhois/0.2.1
    • Design: telnet client accessing whois telnet query interface from RIR(?)
    • Pros: Able to handle IP address lookups
    • Cons: Able to pull information from whois servers of other RIRs?

    pywhois:

    • Home: http://code.google.com/p/pywhois/
    • Design: REST client accessing RRID whois services
    • Pros: Accessses many RRIDs; has python 3.x branch
    • Cons: does not seem to handle IP address lookups

    python-whois:

    • Home: http://code.google.com/p/python-whois/
    • Design: wraps "whois" command
    • Cons: does not seem to handle IP address lookups

    whoisclient - fork of python-whois

    • Home: http://gitorious.org/python-whois
    • Design: wraps "whois" command
    • Depends on: IPy.py
    • Cons: does not seem to handle IP address lookups

    Update: I ended up using pywhoisapi for the reverse IP lookups that I was doing

提交回复
热议问题