ipwhois

1.3.0 · active · verified Wed Apr 15

ipwhois is a Python package designed for retrieving and parsing whois data for both IPv4 and IPv6 addresses. It is currently at version 1.3.0 and actively maintained, though its release cadence can be irregular.

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to perform a basic RDAP lookup using the IPWhois class. RDAP (Registration Data Access Protocol) is the recommended method for retrieving data. The `depth` parameter controls how many recursive lookups are performed for associated entities.

from ipwhois import IPWhois
from pprint import pprint

# Using a public IP for demonstration
ip_address = '74.125.225.229'

# Initialize IPWhois object
obj = IPWhois(ip_address)

# Perform RDAP lookup (recommended method)
# depth=1 retrieves top-level network information
# For more recursive lookups, increase depth
results = obj.lookup_rdap(depth=1)

pprint(results)

view raw JSON →