pricing background

Python SDK Integration

Whois API

Unlock WHOIS Data with Python: WhoisFreaks SDK Made Simple

The WhoisFreaks Python SDK offers robust WHOIS lookup functionality, allowing developers to access both real-time and historical WHOIS data. This enables you to retrieve comprehensive domain registration details, monitor ownership history, and analyze domain changes making it an essential resource for domain research and cybersecurity efforts.

How to perform WHOIS Lookup(s) Using Python?

The Python WHOIS SDK package enables you to perform a wide range of WHOIS lookups, including live, historical, reverse, and bulk live lookup queries.
To use the WhoisFreaks Python SDK for WHOIS lookups, 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.

1. WHOIS Live Lookup

whois_lookup (with whois='live' as param) fetches real-time WHOIS information for a specific domain using the WhoisFreaks WHOIS Lookup service.

python
whois_lookup(whois='live', api_key='your_api_key', domain_name='example.com')

Parameters:

  1. domain_name: The domain name for which live WHOIS information is requested (e.g., "example.com").
  2. api_key: Get your API key from our billing dashboard.
  3. format: Two formats are available JSON, XML. If you don't specify the 'format' parameter, the default format will be JSON.

Returns:

  1. Success: A JSON string containing the domain_info structure with live domain details.
  2. 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, please refer to the WHOIS Live documentation.

Example Usage:

python
from whoisfreaks import WhoisfreaksApi
from whoisfreaks.core.api_error import ApiError

client = WhoisfreaksApi()

try:
    response = client.whois_lookup(whois='live', 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)

2. WHOIS Bulk Live Lookup

bulk_domain_lookup bulk_domain_lookup retrieves live WHOIS data for multiple domains simultaneously using WhoisFreaks' WHOIS Bulk Lookup module. Please note that the maximum limit is 100 domains per request. If you need to perform a live DNS lookup for more than 100 domains, you can contact us or sign in to submit a bulk request via file upload. You may upload a file containing over 100 domains, up to a maximum of 3,000,000.

python
bulk_domain_lookup(api_key='your_api_key', domain_names=['google.es', 'hey.com', 'jfreaks.com', 'ss.ssss'])

Parameters:

  1. domain_name: A list of strings containing the domain names for which live WHOIS information is requested.
  2. api_key: Get your API key from our billing dashboard.
  3. format: Two formats are available JSON, XML. If you don't specify the 'format' parameter, the default format will be JSON.

Returns:

  1. Success: A JSON list of bulk_whois_response containing a structure with live domain information for all requested domain names in the bulk request.
  2. 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, please refer to the Bulk WHOIS Live documentation.

Example Usage:

python
from whoisfreaks import WhoisfreaksApi
from whoisfreaks.core.api_error import ApiError

client = WhoisfreaksApi()

try:
    response = client.bulk_domain_lookup(api_key='your_api_key', domain_names=['google.es', 'hey.com', 'jfreaks.com', 'ss.ssss'])
    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)

3. WHOIS Historical Lookup

whois_lookup (with whois='historical' as param) retrieves historical WHOIS information for a domain using WhoisFreaks' Historical Lookup service.

python
.whois_lookup(whois='historical', api_key='your_api_key', domain_name='example.com')

Parameters:

  1. domain_name: The domain name for which historical WHOIS information is requested (e.g., "example.com").
  2. api_key: Get your API key from our billing dashboard.
  3. format: Two formats are available JSON, XML. If you don't specify the 'format' parameter, the default format will be JSON.

Returns:

  1. Success: A JSON string containing the whois_domains_historical structure with historical domain information.
  2. 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 WHOIS Historical's documentation.

Example Usage:

python
from whoisfreaks import WhoisfreaksApi
from whoisfreaks.core.api_error import ApiError

client = WhoisfreaksApi()

try:
    response = client.whois_lookup(whois='historical', api_key='your_api_key', domain_name='google.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.

4. WHOIS Reverse Lookup

whois_lookup (with whois='reverse' as param) performs a reverse WHOIS lookup using the WhoisFreaks' reverse lookup module from Python SDK.

python
whois_lookup(whois='reverse', api_key='your_api_key', keyword='example')

Parameters:

  1. keyword: The keyword to search for in domain records.
  2. email: The email address to search for in domain records.
  3. company: The company name to search for in domain records.
  4. owner: The owner name to search for in domain records.
  5. Provide only one parameter from the four options mentioned above.
  6. mode: Two modes are available mini & default. Just like Reverse Lookup whois.reverse_lookup is used to perform a reverse WHOIS lookup in mini mode with an extra param in it i.e., mode='mini'. By default, mode is set to default.
  7. format: Two formats are available JSON, XML. If you don't specify the 'format' parameter, the default format will be JSON.
  8. exact: The 'exact' parameter can be either 'true' or 'false'. Exact match is allowed only in case of keywords, owner/registrant, or company, not emails as in case of emails response is already fetched based on exact match.
  9. page: The optional page number for paginated results. Leave empty for the first page.
  10. api_key: Get your API key from our billing dashboard.

Returns:

  1. Success: A JSON string containing a whois_domains_historical struct with reverse WHOIS information and some other info.
  2. 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 WHOIS Lookup's documentation.

Example Usage:

python
from whoisfreaks import WhoisfreaksApi
from whoisfreaks.core.api_error import ApiError

client = WhoisfreaksApi()

try:
    response = client.whois_lookup(whois='reverse', api_key='your_api_key', keyword='example')
    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 keyword, email, owner, company, and page with the desired keyword, email address, owner name, company name, and page number, respectively.

5. IP WHOIS Lookup

ip_whois_lookup fetches real-time WHOIS information for a specific domain using the WhoisFreaks WHOIS Lookup service.

python
ip_whois_lookup(api_key='your_api_key', ip='1.1.1.1')

Parameters:

  1. ip: The IPv4 or IPv6 for which IP WHOIS information are requested (e.g., "8.8.8.8", "fe80::200:5aee:feaa:20a2").
  2. api_key: Get your API key from our billing dashboard.
  3. format: Two formats are available JSON, XML. If you don't specify the 'format' parameter, the default format will be JSON.

Returns:

  1. Success: A JSON string containing the ip_info structure with different IP details.
  2. Error: A JSON string containing the error structure if an API error occurs, or 'nil' if the request fails.

For a more details related to the response fields, you can visit the IP Lookup's documentation.

Example Usage:

python
from whoisfreaks import WhoisfreaksApi
from whoisfreaks.core.api_error import ApiError

client = WhoisfreaksApi()

try:
    response = client.ip_whois_lookup(api_key='your_api_key', ip='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 "fe80::200:5aee:feaa:20a2" with the IPv4 or IPv6 you wish to query.

6. ASN WHOIS Lookup

asn_lookup fetches real-time ASN information for a specific Autonomous System Number using the WhoisFreaks ASN Lookup tool.

python
asn_lookup(api_key='your_api_key', asn='1213')

Parameters:

  1. asn: The ASN number for which information is being requested (e.g., "1" or "AS1").
  2. api_key: Get your API key from our billing dashboard.
  3. format: Two formats are available JSON, XML. If you don't specify the 'format' parameter, the default format will be JSON.

Returns:

  1. Success: A JSON string containing the asn_info structure with real time ASN details.
  2. 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, please refer to the ASN Lookup's documentation.

Example Usage:

python
from whoisfreaks import WhoisfreaksApi
from whoisfreaks.core.api_error import ApiError

client = WhoisfreaksApi()

try:
    response = client.asn_lookup(api_key='your_api_key', asn='1213')
    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 "AS1213" with the ASN you wish to query.

DNS Checker API

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.

1. 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
live_dns_lookup(type='all', api_key='your_api_key', domain_name='example.com', ip_address='1.1.1.1')

Parameters:

  1. type: The type of DNS record to look up (e.g., "A", "MX", "CNAME", "AAAA", "NS", "TXT", "SOA", "SPF").
  2. 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.
  3. ip_address: The IPv4 for which live DNS information is requested. For an IP address, only the PTR record will be fetched.
  4. format: Two formats are available JSON, XML. If you don't specify the 'format' parameter, the default format will be JSON.
  5. api_key: Get your API key from our billing dashboard.

Returns:

  1. Success: A JSON string containing a dns_info struct with live DNS information.
  2. Error: A JSON string containing the error structure if an API error occurs, or 'nil' if the request fails.

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.

For complete details on the response fields, please visit the DNS Live Documentation.

Example Usage:

python
from 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.

2. 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
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'])

Parameters:

  1. type: The type of DNS record to look up (e.g., "A", "MX", "CNAME", "AAAA", "NS", "TXT", "SOA", "SPF").
  2. 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.
  3. 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.
  4. format: Two formats are available JSON, XML. If you don't specify the 'format' parameter, the default format will be JSON.
  5. api_key: Get your API key from our billing dashboard.

Returns:

  1. Success: A JSON string containing a dns_bulk_info struct with live DNS information.
  2. Error: A JSON string containing the error structure if an API error occurs, or 'nil' if the request fails.

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.

For complete details on the response fields, please visit the DNS Bulk Lookup Documentation.

Example Usage:

python
from 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)

Replace the domain names and IP addresses with your specific values.

3. 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
historical_dns_lookup(type='all', api_key='your_api_key', domain_name='example.com')

Parameters:

  1. type: The type of DNS record to look up (e.g., "A", "MX", "CNAME", "AAAA", "NS", "TXT", "SOA", "SPF").
  2. domain_name: The domain name for which historical DNS information is requested.
  3. page: The optional page number for paginated results. Leave empty for the first page.
  4. format: Two formats are available JSON, XML. If you don't specify the 'format' parameter, the default format will be JSON.
  5. api_key: Get your API key from our billing dashboard.

Returns:

  1. Success: A pointer to a historical_dns_info struct containing historical DNS information.
  2. 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
from 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.

4. DNS Reverse Lookup

reverse_dns_lookup is used to get data for reverse DNS lookup of any value based on its type.

python
reverse_dns_lookup(api_key='your_api_key', type='a', value='1.1.1.1')

Parameters:

  1. type: The type of DNS record to look up (e.g., "a", "mx", "aaaa", "ns", etc.). Multiple records are not supported.
  2. value: Value of DNS record like IP Address, MX, NS Server or value for which reverse DNS information is requested.
  3. page: The optional page number for paginated results. Leave empty for the first page.
  4. exact: It's an optional parameter which can be either 'true' or 'false'.
  5. format: Two formats are available JSON, XML. If you don't specify the 'format' parameter, the default format will be JSON.
  6. api_key: Get your API key from our billing dashboard.

Returns:

  1. Success: A JSON string with a reverse_dns_info structure containing reverse DNS data.
  2. Error: A JSON string containing the error structure if an API error occurs, or 'nil' if the request fails.

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.

For detailed info about the response fields, you can visit the Reverse DNS Lookup's documentation.

Example Usage:

python
from 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.

SSL Certificate API

Check SSL Certificate Info Using WhoisFreaks Python SDK

The WhoisFreaks Python SDK allows you to fetch SSL certificate details for any domain, including the certificate’s validity period, issuing authority, and other essential information. This helps ensure secure communication, verify website authenticity, and is crucial for maintaining web security and protecting online transactions.

SSL Lookup

This package is for performing any type of SSL lookup.
To utilize the WhoisFreaks Python SDK for SSL Lookup of domain names, 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.

1. SSL Live Lookup

ssl_live_lookup retrieves live SSL information for a specific domain using the Python SDK's SSL endpoint.

python
ssl_live_lookup(api_key='your_api_key', domain_name='google.com')

Parameters:

  1. domain_name: The domain name for which live SSL information is requested (e.g., "example.com").
  2. chain: A boolean flag indicating whether to include SSL certificate chain information.
  3. ssl_raw: A boolean flag indicating whether to include raw SSL certificate information.
  4. format: Two response formats are available: JSON and XML. If the 'format' parameter is not specified, JSON will be used by default.
  5. api_key: Get your API key from our billing dashboard.

Returns:

  1. Success: A pointer to a domain_ssl_info struct containing live SSL information.
  2. 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, please visit the SSL Live Lookup Documentation.

Example Usage:

python
from whoisfreaks import WhoisfreaksApi
from whoisfreaks.core.api_error import ApiError

client = WhoisfreaksApi()

try:
    response = client.ssl_live_lookup(api_key='your_api_key', domain_name='google.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 "google.com" with the domain you wish to query.

Domain Availability API

Python SDK for Domain Availability Lookup with WhoisFreaks API

The WhoisFreaks Python SDK allows developers to check the availability of domain names, making it easier to identify domains that are open for registration. This functionality supports domain acquisition, brand protection, and strategic management of digital assets by uncovering new domain opportunities.

Domain Availability Lookup

This package is for performing any type of Domain Availability Lookup.
To utilize the WhoisFreaks Python SDK for checking the availability of domain names, 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.

1. Domain Availability Check

domain_availability_lookup performs a domain availability check using the WhoisFreaks API. It checks whether a specific domain name is available for registration.

python
domain_availability_lookup(api_key='your_api_key', domain='google.com', sug=True)

Parameters:

  1. domain: The domain name to be checked for availability (e.g., "example.com").
  2. sug: For getting suggestions, it can be passed with or without a count. There are two possible values for sug: true or false. If you don't specify the sug parameter, the default value will be false.
  3. count: If sug is true, then count can be passed for the desired number of suggestions. Default value of count is 5.
  4. source: By default, a live WHOIS lookup is used to check domain availability for higher reliability. For faster responses, you can set the source to dns.
  5. format: Two formats are available JSON, XML. If you don't specify the 'format' parameter, the default format will be JSON.
  6. api_key: Get your API key from our billing dashboard.

Returns:

  1. Success: A simple domain availability flag or a pointer to a domain_available_response struct containing domain availability of requested domain name and some other suggested domains.
  2. 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, please visit the Domain Availability Lookup Documentation.

Example Usage:

python
from whoisfreaks import WhoisfreaksApi
from whoisfreaks.core.api_error import ApiError

client = WhoisfreaksApi()

try:
    response = client.domain_availability_lookup(api_key='your_api_key', domain='google.com', sug=True)
    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 "whois.com" with the domain you wish to check.