Registry / http-networking / whois
library1.20240129.2pypypi✓ verified 88d ago

Python library for retrieving WHOIS information of domains. Provides domain registration details like registrar, creation date, expiration date, and name servers. Supports a wide range of TLDs through embedded server configurations. Current version: 1.20260326.1, requires Python >=3.9. Active development with monthly releases.

pip install whois
INSTALL
IMPORT
SIG · WHOIS
W
whois
http-networkingpythonv1.20240129.2
Install
1.6s avg
Import
237ms
Disk
16MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.9–3.13
musl
3.9–3.13
Install & Compatibility
Where this runs
tested against v1.20240129.2 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.10–3.95 runs
installs and imports cleanly · install 0.0s · import 0.236s · 18.4MB
glibc
py 3.10–3.95 runs
installs and imports cleanly · install 1.6s · import 0.238s · 19MB
16MB installed
● package 16MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

whois
✓ import whois
This is the only correct import.

Query WHOIS information for a domain.

import whois domain = whois.whois('example.com') print(domain.text)
whois --version
Debug
Known issues
gotchaImport the library using 'import whois', not 'from whois import whois'. The module name and function name are the same, which can be confusing.
fix
Use 'import whois' then call 'whois.whois(domain)'.
affects: all
deprecatedThe 'whois' function returns a simple object in older versions; newer versions return a more structured object. Avoid relying on attribute names without checking the actual response.
fix
Always access fields using dict-like or attribute access after checking the object type.
affects: >=1.20230906.1
gotchaWHOIS servers often have rate limits. Making many queries in quick succession may result in temporary IP bans or incomplete results.
fix
Add delays between queries (e.g., time.sleep(1)) or use a rotating proxy list.
affects: all
breakingThe 'tld' parameter behavior changed in 1.20240129.1. The library now handles some second-level domains for .uk differently.
fix
If you rely on custom TLD handling, verify results for .uk domains.
affects: >=1.20240129.1
Errors
Common errors & fixes
AttributeError: module 'whois' has no attribute 'whois'
The library is imported but the import is wrong or the package is not installed correctly.
fix
Ensure you installed the correct package: 'pip install whois'. Then use 'import whois' and call 'whois.whois(domain)'.
whois.parser.PywhoisError: Failed to parse WHOIS response for <domain>
The WHOIS server returned an unexpected format or the domain has no WHOIS record.
fix
Verify the domain exists and is registered. If the issue persists, try querying with a different server or update the library to the latest version.
TypeError: 'str' object is not callable
Accidentally imported the function as 'from whois import whois' but later reassigned 'whois' to a string or other non-callable.
fix
Use 'import whois' and call 'whois.whois()', not 'whois()' directly.
Upgrade
Version history
1.20240129.2latest on PyPI · released Feb 3, 2024
Audit
Dependencies

No dependency data recorded yet.

Agent activity
54 hits · last 30 days
node
46
OpenAI (training)
1
Resources
whois — pip install whois · libregistry