Goal
- Create a simple importable Python module which will produce parsed WHOIS data for a given domain.
- Able to extract data for all the popular TLDs (com, org, net, ...)
- Query a WHOIS server directly instead of going through an intermediate web service like many others do.
Example
>>> import whois
>>> w = whois.whois('example.com')
>>> w.expiration_date # dates converted to datetime object
datetime.datetime(2022, 8, 13, 4, 0, tzinfo=tzoffset('UTC', 0))
>>> w.text # the content downloaded from whois server
u'\nDomain Name: EXAMPLE.COM
Registry Domain ID: 2336799_DOMAIN_COM-VRSN
...'
>>> print(w) # print values of all found attributes
{
"creation_date": "1995-08-14 04:00:00+00:00",
"expiration_date": "2022-08-13 04:00:00+00:00",
"updated_date": "2021-08-14 07:01:44+00:00",
"domain_name": "EXAMPLE.COM",
"name_servers": [
"A.IANA-SERVERS.NET",
"B.IANA-SERVERS.NET"
],
...
Install
Install from pypi:
pip install python-whois
Or checkout latest version from repository:
git clone git@github.com:richardpenman/whois.git
pip install -r requirements.txt
Run test cases:
python -m pytest
Using a proxy.
Set your environment SOCKS variable
export SOCKS="username:password@proxy_address:port"
Problems?
Pull requests are welcome!
Thanks to the many who have sent patches for additional TLDs. If you want to add or fix a TLD it's quite straightforward. See example domains in whois/parser.py
Basically each TLD has a similar format to the following:
class WhoisOrg(WhoisEntry):
"""Whois parser for .org domains
"""
regex = {
'domain_name': 'Domain Name: *(.+)',
'registrar': 'Registrar: *(.+)',
'whois_server': 'Whois Server: *(.+)',
...
}
def __init__(self, domain, text):
if text.strip() == 'NOT FOUND':
raise WhoisDomainNotFoundError(text)
else:
WhoisEntry.__init__(self, domain, text, self.regex)
Metadata
Release files for python-whois 0.9.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| python_whois-0.9.6.tar.gz | 125.1 kB | Without provenance | Details for python_whois-0.9.6.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| python_whois-0.9.6-py3-none-any.whl | Python 3 | none | any | Details for python_whois-0.9.6-py3-none-any.whl |
Total release size: 242.1 kB
Release files / python_whois-0.9.6.tar.gz
| Download URL | python_whois-0.9.6.tar.gz |
|---|---|
| Size | 125.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2e6de7b6d70e305a85f4859cd17781ee3f0da3a02a8e94f23cb4cdcd2e400bfa
|
|
BLAKE2b-256 checksum How to use checksums |
f10c537914eca91ee5ff281309a5ca71da23c0c975cd6658668a44d3fdcf1cc4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.5
|
Release files / python_whois-0.9.6-py3-none-any.whl
| Download URL | python_whois-0.9.6-py3-none-any.whl |
|---|---|
| Size | 117.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
153261941a4d238b1278a4ca9b5b5e0590ed3b4d0c534ba111c4434d5d339410
|
|
BLAKE2b-256 checksum How to use checksums |
4653d0ceb3ae30da8e8ec2d9af11050178f3b4114d5aa6a7f7074199db3c806f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.5
|
Security for python-whois 0.9.6
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.