PyFunceble Development

4.4.1 · active · verified Fri Apr 17

PyFunceble is a Python library and CLI tool designed to check the availability or syntax of domains, IP addresses, and URLs. It's actively maintained with frequent releases, currently at version 4.4.1, offering robust tools for network hygiene and security analysis. The 'dev' package suffix often indicates the latest development branch.

Common errors

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to programmatically use PyFunceble to check the status of domains. It initializes the PyFunceble engine, tests a single domain, and prints key results. A temporary directory is used for output files to keep your system clean, and logging is suppressed for a concise output.

import tempfile
import shutil
from PyFunceble import PyFunceble

# Create a temporary directory for PyFunceble's output (logs, databases)
output_dir = tempfile.mkdtemp()

try:
    print(f"PyFunceble output will be stored in: {output_dir}")

    # Initialize PyFunceble. Pass output_dir to control where files are created.
    # For a fully quiet operation, you can configure logging separately.
    funceble = PyFunceble(output_dir=output_dir, 
                          log_level='CRITICAL', 
                          autodisconnect=True)

    # Test a single domain
    domain_to_test = "google.com"
    print(f"\nTesting '{domain_to_test}'...")
    results = funceble.test_single(domain_to_test)
    print(f"Results for {domain_to_test}: Status = {results.get('status', 'N/A')}, ")
    print(f"  Expiration = {results.get('expiration_date', 'N/A')}, ")
    print(f"  HTTP Status = {results.get('http_status_code', 'N/A')}")

    # Test a known non-existent domain (for demonstration)
    non_existent_domain = "thisdomainreallyshouldntexist.xyz"
    print(f"\nTesting '{non_existent_domain}'...")
    results_non_existent = funceble.test_single(non_existent_domain)
    print(f"Results for {non_existent_domain}: Status = {results_non_existent.get('status', 'N/A')}")

finally:
    # Clean up the temporary directory after use
    print(f"\nCleaning up temporary output directory: {output_dir}")
    shutil.rmtree(output_dir)

view raw JSON →