Developer Libraries
Third-party Integrations
Python SDK for DNS Lookup: Simplify Integration with WhoisFreaks APIs
The SDK enables live, historical, and reverse DNS lookups, allowing you to access detailed DNS records essential for network analysis, troubleshooting, and verifying domain configurations. It’s an ideal tool for developers handling DNS data and performing network diagnostics.
DNS Lookups
This package is for performing any type of DNS lookup, such as live, historical, or reverse lookups.
To utilize the WhoisFreaks Python SDK for DNS Lookups of domain names or IP addresses, follow these steps:
First, ensure that Python and the WhoisFreaks Python SDK are installed on your system. To install the necessary modules, please visit the Installation Steps page.
In all lookups, replace "your_api_key" with your actual API key.
-
DNS Live Lookup
live_dns_lookup performs a live DNS lookup using the WhoisFreaks API. It retrieves real-time DNS information for a specific domain or an IP address.
python Copylive_dns_lookup(type='all', api_key='your_api_key', domain_name='example.com', ip_address='1.1.1.1')
Parameters:
- type: The type of DNS record to look up (e.g., "A", "MX", "CNAME", "AAAA", "NS", "TXT", "SOA", "SPF").
- domain_name: The domain name for which live DNS information is requested. For a domain name, all available records of these 8 DNS types will be fetched: A, AAAA, MX, NS, SPF, SOA, TXT, and CNAME.
- ip_address: The IPv4 for which live DNS information is requested. For an IP address, only the PTR record will be fetched.
- format: Two formats are available JSON, XML. If you don't specify the 'format' parameter, the default format will be JSON.
- api_key: Get your API key from our billing dashboard.
Note: You can enter a domain name, an IPv4 address, or both. For a domain name, all available records of these 8 DNS types will be fetched: A, AAAA, MX, NS, SPF, SOA, TXT, and CNAME. For an IP address, only the PTR record will be fetched.Returns:
- Success: A JSON string containing a dns_info struct with live DNS information.
- Error: A JSON string containing the error structure if an API error occurs, or 'nil' if the request fails.
For complete details on the response fields, please visit the DNS Live Documentation.Example Usage:
python Copyfrom whoisfreaks import WhoisfreaksApi from whoisfreaks.core.api_error import ApiError client = WhoisfreaksApi() try: response = client.live_dns_lookup(type='all', api_key='your_api_key', domain_name='example.com', ip_address='1.1.1.1') response = {k: v for k, v in response.dict().items() if v is not None} # Filtering the Null values print(response) except ApiError as e: print(e.body)
Replace example.com with your specific domain name and 1.1.1.1 with the IP address you wish to query.
-
Bulk DNS Live Lookup
bulk_dns_lookup fetches live DNS data for multiple domains or IP addresses at once using WhoisFreaks' DNS Bulk Lookup module. Keep in mind that each request supports up to 100 domains and 100 IPs. To perform lookups for more than 100 domains or IP addresses, you can contact us or sign in and upload a file for bulk processing. Files can contain over 100 entries, with a maximum limit of 3,000,000.
python Copybulk_dns_lookup(type='all', api_key='your_api_key', domain_names=['domain1.com', 'domain2.com'], ip_addresses=['1.1.1.1', '8.8.8.8'])
Parameters:
- type: The type of DNS record to look up (e.g., "A", "MX", "CNAME", "AAAA", "NS", "TXT", "SOA", "SPF").
- domain_names: A list of domain names for which live DNS information is requested. For each domain, all available records from the following 8 DNS types will be retrieved: A, AAAA, MX, NS, SPF, SOA, TXT, and CNAME.
- ip_addresses: A list of IPv4 addresses for which live DNS information is requested. For each IP address, only the PTR record will be retrieved.
- format: Two formats are available JSON, XML. If you don't specify the 'format' parameter, the default format will be JSON.
- api_key: Get your API key from our billing dashboard.
Note: You can provide a list of domain names, IPv4 addresses, or both for bulk DNS lookup. For each domain name, all available records of the following 8 DNS types will be retrieved: A, AAAA, MX, NS, SPF, SOA, TXT, and CNAME. For each IPv4 address, only the PTR record will be returned.Returns:
- Success: A JSON string containing a dns_bulk_info struct with live DNS information.
- Error: A JSON string containing the error structure if an API error occurs, or 'nil' if the request fails.
For complete details on the response fields, please visit the DNS Bulk Lookup Documentation.Example Usage:
python Copyfrom whoisfreaks import WhoisfreaksApi from whoisfreaks.core.api_error import ApiError client = WhoisfreaksApi() try: response = client.bulk_dns_lookup(type='all', api_key='your_api_key', domain_names=['domain1.com', 'domain2.com'], ip_addresses=['1.1.1.1', '8.8.8.8']) response = {k: v for k, v in response.dict().items() if v is not None} # Filtering the Null values print(response) except ApiError as e: print(e.body)
-
DNS Historical Lookup
historical_dns_lookup uses the WhoisFreaks Python SDK's historical function to retrieve historical DNS records for a given domain and DNS record type.
python Copyhistorical_dns_lookup(type='all', api_key='your_api_key', domain_name='example.com')
Parameters:
- type: The type of DNS record to look up (e.g., "A", "MX", "CNAME", "AAAA", "NS", "TXT", "SOA", "SPF").
- domain_name: The domain name for which historical DNS information is requested.
- page: The optional page number for paginated results. Leave empty for the first page.
- format: Two formats are available JSON, XML. If you don't specify the 'format' parameter, the default format will be JSON.
- api_key: Get your API key from our billing dashboard.
Returns:
- Success: A pointer to a historical_dns_info struct containing historical DNS information.
- Error: A JSON string containing the error structure if an API error occurs, or 'nil' if the request fails.
For a comprehensive details of response fields, you can visit the DNS Historical's documentation.Example Usage:
python Copyfrom whoisfreaks import WhoisfreaksApi from whoisfreaks.core.api_error import ApiError client = WhoisfreaksApi() try: response = client.historical_dns_lookup(type='all', api_key='your_api_key', domain_name='example.com') response = {k: v for k, v in response.dict().items() if v is not None} # Filtering the Null values print(response) except ApiError as e: print(e.body)
Replace "example.com" with the domain you wish to query, adjust type as needed, and specify the page number if necessary.
-
DNS Reverse Lookup
reverse_dns_lookup is used to get data for reverse DNS lookup of any value based on its type.
python Copyreverse_dns_lookup(api_key='your_api_key', type='a', value='1.1.1.1')
Parameters:
- type: The type of DNS record to look up (e.g., "a", "mx", "aaaa", "ns", etc.). Multiple records are not supported.
- value: Value of DNS record like IP Address, MX, NS Server or value for which reverse DNS information is requested.
- page: The optional page number for paginated results. Leave empty for the first page.
- exact: It's an optional parameter which can be either 'true' or 'false'.
- format: Two formats are available JSON, XML. If you don't specify the 'format' parameter, the default format will be JSON.
- api_key: Get your API key from our billing dashboard.
Note: The value you enter must correspond to the DNS type. For example, for the aaaa type, the value should be an IPv6 address like 2001:db8::1. For the ns type, the value should be a nameserver such as ns1.google.com.Returns:
- Success: A JSON string with a reverse_dns_info structure containing reverse DNS data.
- Error: A JSON string containing the error structure if an API error occurs, or 'nil' if the request fails.
For detailed info about the response fields, you can visit the Reverse DNS Lookup's documentation.Example Usage:
python Copyfrom whoisfreaks import WhoisfreaksApi from whoisfreaks.core.api_error import ApiError client = WhoisfreaksApi() try: response = client.reverse_dns_lookup(api_key='your_api_key', type='a', value='1.1.1.1') response = {k: v for k, v in response.dict().items() if v is not None} # Filtering the Null values print(response) except ApiError as e: print(e.body)
Replace "1.1.1.1" with the IP address you wish to query, adjust dns type as needed, and specify the page number if necessary.
To perform other lookups using the Python SDK, click on one of the related options below.
WHOIS lookups
Offers live, reverse, historical, IP, ASN, and bulk domain WHOIS lookups.
Domain Availability
Checks domain availability across TLDs and suggests alternatives.
SSL Lookups
Performs SSL lookup and shows certificate chain from start to present.
Explore the official WhoisFreaks Python SDK documentation for DNS record lookups and management.

WhoisFreaks Python SDK
Use this powerful Python-based SDK to easily integrate, interact with, and manage data from the WhoisFreaks API seamlessly.
whoisfreaks.docs.buildwithfern.com