- A Python package for retrieving WHOIS information of domains.
- This package will not support querying ip CIDR ranges or AS information
- It requires the whois cli component of your os to be installed: e.g.
/usr/bin/whois
on Linux
- 2023-04-25: mboot
- when DannyCork returns he can decide on the future of this repo.
- in his absence future development will take place in: https://github.com/mboot-github/WhoisDomain
- and new pypi releases will come from: https://pypi.org/project/whoisdomain/
- efforts will be made to keep the v1.x.y version of whoisdomain compatible with this repo
- changes will be verified and back copied also here for the time being
- starting 2024-02, this repo will be abandon-ware
- Python 3.x is supported for x >= 9
- Python 2.x IS NOT supported.
- Python wrapper for the "whois" cli command of your operating system.
- Simple interface to access parsed WHOIS data for a given domain.
- Able to extract data for all the popular TLDs (com, org, net, biz, info, pl, jp, uk, nz, ...).
- Query a WHOIS server directly instead of going through an intermediate web service like many others do.
- Works with Python >= 3.9
- All dates as datetime objects.
- Possibility to cache results.
- Verbose output on stderr during debugging to see how the internal functions are doing their work
- raise a exception on Quota ecceeded type responses
- raise a exception on PrivateRegistry tld's where we know the tld and know we don't know anything
- allow for optional cleaning the whois response before extracting information
- optionally allow IDN's to be translated to Punycode
- optional specify the whois command on query(...,cmd="whois") as in: https://github.com/gen1us2k/python-whois/
- please install also the command line "whois" of your distribution
- this library parses the output of the "whois" cli command of your operating system
- docker pull mbootgithub/whoisdomain:latest
Your contributions are welcome, look for the Help wanted tag https://github.com/DannyCork/python-whois/labels/help%20wanted
Install the cli whois
of your operating system if it is not present already
Install whois
package from your distribution (e.g apt install whois)
$pip install whois
>>> import whois
>>> domain = whois.query('google.com')
>>> print(domain.__dict__)
{
'expiration_date': datetime.datetime(2020, 9, 14, 0, 0),
'last_updated': datetime.datetime(2011, 7, 20, 0, 0),
'registrar': 'MARKMONITOR INC.',
'name': 'google.com',
'creation_date': datetime.datetime(1997, 9, 15, 0, 0)
}
>>> print(domain.name)
google.com
>>> print(domain.expiration_date)
2020-09-14 00:00:00
see the file: ./whois/tld_regexpr.py or call whois.validTlds()
- Raise an issue https://github.com/DannyCork/python-whois/issues/new
- the returned list of name_servers is now a sorted unique list and not a set
- the help function whois.validTlds() now outputs the true tld with dots
- add test2.py to replace test.py
- ./test2.py -h will show the possible usage
- all tests from the original program are now files in the ./tests directory
- test can be done on all supported tld's with -a or --all and limitest by regex with -r or --reg=
- add support for Iana example.com, example.net
- add testing against static known data in dir: ./testdata//output
- test.sh will test all domains in testdata without actually calling whois, the input data is instead read from testdata//input
- add support for returning the raw data from the whois command: flag include_raw_whois_text
- add support for handling unsupported domains via whois raw text only: flag return_raw_text_for_unsupported_tld
- add an opportunity to specify maximum cache age
- convert the tld file to a Dict, we now no longer need a mappper for python keywords or second level domains.
- utf8 level domains also need no mapper anymore an can be added as is with a translation to xn--
- added xn-- tlds for all known utf-8 domains we currently have
- we can now add new domains on the fly or change them: whois.mergeExternalDictWithRegex(aDictToOverride) see example exampleExtend.py
- add autodetect via iana tld file (this has only tld's)
- add a central collection of all compiled regexes and reuse them: REG_COLLECTION_BY_KEY in _0_init_tld.py
- refresh testdata now that tld has dot instead of _ if more then one level
- add additional strings meaning domain does not exist
- whois.QuotaStringsAdd(str) to add additional strings for over quota detection. whois.QuotaStrings() lists the current configured strings
- whois.NoneStringsAdd(str) to add additional string for NoSuchDomainExists detection (whois.query() retuning None). whois.NoneStrings() lsts the current configured strings
- suppress messages to stderr if not verbose=True
- sync with https://github.com/mboot-github/WhoisDomain; 1.20230720.1; (gov.tr), (com.ru, msk.ru, spb.ru), (option to preserve partial output after timeout)
- sync with https://github.com/mboot-github/WhoisDomain; 1.20230720.2; add t_test hint support; fix some server hints
- abandon any python below 3.9 (mypy compatibilities)
- major refactor into more object based approch and parameterContext
- allow custom caching backends (e.g. redis, dbm, ...)
- Sync with latest whoisdomain
- Allow cleaning up the http(s) info in the status response.
- Allow correlation with tld (pip install tld) public_suffix.
- Allow display of what whois-servers were used until we reach the final item.