A Python package for retrieving WHOIS information of domains.
- Python wrapper for Linux "whois" command.
- 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.x.
- 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
Your contributions are welcome, look for the Help wanted tag https://github.com/DannyCork/python-whois/labels/help%20wanted
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
2022-06-09: maarten_boot:
- 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
Python 3.x is supported.
Python 2.x IS NOT supported.