dnspython

2.8.0 · active · verified Sat Mar 28

dnspython is a comprehensive DNS toolkit for Python, currently at version 2.8.0, supporting Python 3.10 and above. It is actively maintained and follows a regular release cadence.

Warnings

Install

Imports

Quickstart

This script queries the A records for 'example.com' and prints each IP address.

import dns.resolver

# Query for A records of 'example.com'
result = dns.resolver.resolve('example.com', 'A')
for ipval in result:
    print('IP', ipval.to_text())

view raw JSON →