Python WHOIS Client

0.9.6 · active · verified Thu Apr 09

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.

Warnings

Install

Imports

Quickstart

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)

view raw JSON →