Registry / http-networking / python-whois

python-whois

JSON →
library0.9.6pypypi✓ verified 35d ago

python-whois is a Python library for querying WHOIS servers directly and parsing domain registration information. It aims to provide structured data for various Top-Level Domains (TLDs) and is currently at version 0.9.6, with recent activity in October 2025. The library focuses on direct server queries rather than relying on intermediate web services.

http-networkingdata
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

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

The primary function is accessed directly via 'whois.whois(domain)'. Do not confuse with other 'whois' libraries or attempt to import sub-modules directly without explicit documentation.

import whois

The quickstart demonstrates how to import the `whois` module and use the `whois.whois()` function to retrieve and parse domain registration data. Key attributes like domain name, registrar, dates, and name servers are easily accessible. The raw WHOIS text is also available.

import whois # Query WHOIS for a domain domain = "example.com" w = whois.whois(domain) # Access parsed attributes print(f"Domain Name: {w.domain_name}") print(f"Registrar: {w.registrar}") print(f"Creation Date: {w.creation_date}") print(f"Expiration Date: {w.expiration_date}") print(f"Name Servers: {w.name_servers}") # Print all found attributes (as a dictionary) # print(w.text) # Uncomment to see the raw WHOIS text # print(w)
Debug
Known footguns
gotchaWHOIS data is semi-structured and can vary significantly between TLDs and registrars. Parsing may not always be 100% accurate or complete, and some fields might be missing or in unexpected formats.
gotchaDirect WHOIS queries can be subject to rate limiting, firewalls, or network issues, leading to timeouts. Some WHOIS servers might be temporarily unavailable or return incomplete responses.
gotchaDue to multiple Python libraries existing with 'whois' in their name (e.g., `pythonwhois`, `whoisdomain`, `ipwhois`), it's common to encounter `AttributeError: module 'whois' has no attribute 'whois'` if the wrong package is installed or a local file conflicts. Ensure you have installed `python-whois` (from richardpenman) and that no local `whois.py` file shadows the library.
Upgrade
Version history

Breaking-change detection hasn't run for this library yet.

Audit
Security & dependencies

CVE tracking and dependency tree are planned for a later release.

Agent activity
0 hits · last 30 days

No traffic data recorded yet.

Resources