### Develop PyFunceble (Setup) Source: https://github.com/funilrys/pyfunceble/wiki/Installation Clone the repository, checkout the 'dev' branch, create a virtual environment, and install PyFunceble in editable mode. ```shell $ git clone https://github.com/funilrys/PyFunceble.git $ cd PyFunceble && git checkout dev && virtualenv venv $ source venv/bin/activate && pip3 install -e . ``` -------------------------------- ### PyFunceble CI Workflow Example Source: https://github.com/funilrys/pyfunceble/blob/dev/docs/use/ci-cd/github-actions.md This workflow demonstrates how to set up and run PyFunceble within a GitHub Actions environment. It includes steps for checking out the repository, setting up Python, installing dependencies, and running PyFunceble against a single domain. Ensure PyFunceble-dev is installed for development-related features. ```yaml name: PyFunceble CI tests on: push: branches: - "my-awesome-branch" pull_request: branches: - "my-awesome-branch" env: # Let PyFunceble know that it has to manage the configuration by itself. PYFUNCEBLE_AUTO_CONFIGURATION: "YES" # We want PyFunceble to push result to the branch, therefore, we need to # declare our git settings. GIT_NAME: "${{ secrets.GIT_BOT_NAME }}" GIT_EMAIL: "${{ secrets.GIT_BOT_EMAIL }}" # Define the branch PyFunceble has to use while working. GIT_BRANCH: my-awesome-branch # Define the branch PyFunceble will push the final result into. GIT_DISTRIBUTION_BRANCH: my-awesome-branch # Define the path of the configuration directory. PYFUNCEBLE_CONFIG_DIR: "${{ github.workspace }}/.pyfunceble" # By settings this variable, PyFunceble will use its GitHub Action feature # to setup and push to the current repository. GITHUB_TOKEN: "${{ secrets.BOT_REPO_PAT }}" jobs: single: name: Run PyFunceble with a single domain runs-on: "${{ matrix.os }}" strategy: fail-fast: false matrix: python_version: - "3.12" os: - ubuntu-latest steps: - uses: actions/checkout@v3 name: Clone repository with: token: "${{ secrets.BOT_REPO_PAT }}" - name: Set up Python ${{ matrix.python_version }} uses: actions/setup-python@v4 with: python-version: ${{ matrix.python_version }} - name: Install dependencies run: | pip install pyfunceble-dev - name: Get PyFunceble version run: | pyfunceble --version - name: Run PyFunceble run: | pyfunceble -a --logging-level critical -d github.com ``` -------------------------------- ### Install PyFunceble with Optional Dependencies Source: https://github.com/funilrys/pyfunceble/blob/dev/README.md Use this syntax to install PyFunceble with specific optional dependencies. For example, to install dependencies for documentation and testing. ```shell pip3 install --user {pkg}[{dependency}] ``` ```shell pip3 install --user pyfunceble[docs,test] ``` -------------------------------- ### Install Documentation Dependencies Source: https://github.com/funilrys/pyfunceble/blob/dev/CONTRIBUTING.md Installs dependencies required for building and serving the PyFunceble documentation. ```shell pip3 install -e .[docs] ``` -------------------------------- ### PyFunceble File Check and Push Workflow Source: https://github.com/funilrys/pyfunceble/blob/dev/docs/use/ci-cd/github-actions.md This workflow extends the previous example by demonstrating how to run PyFunceble against a list of domains from a file (`test.list`) and push the results back to the repository. It requires the `test.list` file to be present at the root of the repository. Ensure `pyfunceble-dev` is installed. ```yaml name: PyFunceble CI tests on: push: branches: - "my-awesome-branch" pull_request: branches: - "my-awesome-branch" env: # Let PyFunceble know that it has to manage the configuration by itself. PYFUNCEBLE_AUTO_CONFIGURATION: "YES" # We want PyFunceble to push result to the branch, therefore, we need to # declare our git settings. GIT_NAME: "${{ secrets.GIT_BOT_NAME }}" GIT_EMAIL: "${{ secrets.GIT_BOT_EMAIL }}" # Define the branch PyFunceble has to use while working. GIT_BRANCH: my-awesome-branch # Define the branch PyFunceble will push the final result into. GIT_DISTRIBUTION_BRANCH: my-awesome-branch # Define the path of the configuration directory. PYFUNCEBLE_CONFIG_DIR: "${{ github.workspace }}/.pyfunceble" # By settings this variable, PyFunceble will use its GitHub Action feature # to setup and push to the current repository. GITHUB_TOKEN: "${{ secrets.BOT_REPO_PAT }}" jobs: file_and_push: name: Run PyFunceble against a file and push result to repository runs-on: "${{ matrix.os }}" strategy: fail-fast: false matrix: python_version: - "3.12" os: - ubuntu-latest steps: - uses: actions/checkout@v3 name: Clone repository with: token: "${{ secrets.BOT_REPO_PAT }}" - name: Set up Python ${{ matrix.python_version }} uses: actions/setup-python@v4 with: python-version: ${{ matrix.python_version }} - name: Install dependencies run: | pip install pyfunceble-dev - name: Get PyFunceble version run: | pyfunceble --version - name: Run PyFunceble # Warning: this assume that the test.list file is at the root of the # repository. run: | pyfunceble -a --ci --logging-level critical -f test.list ``` -------------------------------- ### Install Stable PyFunceble (Pure Python) Source: https://github.com/funilrys/pyfunceble/wiki/Installation Clone the repository and install using setup.py for versions after 0.60.84-beta. ```shell $ git clone https://github.com/funilrys/PyFunceble.git $ cd PyFunceble $ python3 setup.py test && python3 setup.py install ``` -------------------------------- ### Serve Documentation Locally Source: https://github.com/funilrys/pyfunceble/blob/dev/CONTRIBUTING.md Starts a local web server to preview documentation changes in real-time. ```shell mkdocs serve ``` -------------------------------- ### Install PyFunceble-dev Source: https://github.com/funilrys/pyfunceble/blob/dev/README.md Standard installation of the pyfunceble-dev package using pip. ```shell pip3 install --user pyfunceble-dev ``` -------------------------------- ### Use Development PyFunceble (Pure Python) Source: https://github.com/funilrys/pyfunceble/wiki/Installation Clone the repository and checkout the 'dev' branch, then install using setup.py for development versions. ```shell $ git clone https://github.com/funilrys/PyFunceble.git $ cd PyFunceble && git checkout dev $ python3 setup.py test && python3 setup.py install ``` -------------------------------- ### Create Virtual Environment and Activate Source: https://github.com/funilrys/pyfunceble/blob/dev/CONTRIBUTING.md Sets up a Python virtual environment for development. Activate it before installing dependencies. ```shell virtualenv -p python3 venv . venv/bin/activate ``` -------------------------------- ### Install PyFunceble Source: https://github.com/funilrys/pyfunceble/blob/dev/README.md Standard installation of the PyFunceble package using pip. ```shell pip3 install --user pyfunceble ``` -------------------------------- ### Install PyFunceble-dev on Arch Linux Source: https://github.com/funilrys/pyfunceble/blob/dev/README.md Install the development version of PyFunceble on Arch Linux using an AUR helper. Verify the installation by checking the version. ```shell aur-helper -S pyfunceble-dev pyfunceble --version ``` -------------------------------- ### Use Development PyFunceble (pip) Source: https://github.com/funilrys/pyfunceble/wiki/Installation Install the development version from GitHub using pip. ```shell $ pip3 install git+https://github.com/funilrys/PyFunceble.git@dev#egg=PyFunceble ``` -------------------------------- ### Serve PyFunceble Docs from Source Source: https://github.com/funilrys/pyfunceble/blob/dev/README.md Follow these steps to serve the PyFunceble documentation locally from its source code. This involves installing dependencies and running the serve command. ```shell # Install dependencies. pip install --user .[docs] # Serve documentation locally. mkdocs serve # Open Documentation with browser. palemoon http://127.0.0.1:8000 ``` -------------------------------- ### Install Development Dependencies Source: https://github.com/funilrys/pyfunceble/blob/dev/CONTRIBUTING.md Installs PyFunceble and its development/testing dependencies within the activated virtual environment. ```shell pip3 install -e .[dev,test] ``` -------------------------------- ### Install PyFunceble Before 0.60.84-beta Source: https://github.com/funilrys/pyfunceble/wiki/Installation Clone the repository and checkout the 'dev' branch for versions prior to 0.60.84-beta. ```shell $ git clone https://github.com/funilrys/PyFunceble.git && cd PyFunceble && git checkout dev ``` -------------------------------- ### Install Stable PyFunceble (pip) Source: https://github.com/funilrys/pyfunceble/wiki/Installation Install the latest stable version from GitHub using pip for versions after 0.60.84-beta. ```shell $ pip3 install git+https://github.com/funilrys/PyFunceble.git@master#egg=PyFunceble ``` -------------------------------- ### Install PyFunceble-dev Pre-releases Source: https://github.com/funilrys/pyfunceble/blob/dev/README.md Install unstable pre-release versions of pyfunceble-dev using the --pre argument with pip. ```shell pip3 install --user --pre pyfunceble-dev ``` -------------------------------- ### Display PyFunceble Help Source: https://github.com/funilrys/pyfunceble/blob/dev/README.md Shows the help message for the pyfunceble executable, useful after installation via source. ```shell pyfunceble --help ``` -------------------------------- ### PyFunceble Proxy Rules Example Source: https://github.com/funilrys/pyfunceble/blob/dev/docs/use/configuration/parameters/proxy.md Illustrates how to set specific proxy rules for different TLDs and a global proxy for all other domains. This configuration allows for granular control over proxy usage based on domain extensions. ```yaml proxy: rules: - http: http://spec-proxy.example.com https: http://spec-proxy.example.com:8443 tld: - com - org - dev - http: http://onion-proxy.example.com https: http://onion-proxy.example.com tld: - onion global: http: http://proxy.example.com https: http://proxy.example.com:8443 ``` -------------------------------- ### Install PyFunceble from GitHub Source Source: https://github.com/funilrys/pyfunceble/blob/dev/docs/use/installation.md Use this command to install PyFunceble from its GitHub repository. Ensure you replace {{branch}} with the desired branch name (e.g., master). ```shell # From Github pip3 install --upgrade --user https://github.com/funilrys/PyFunceble/archive/{{branch}}.zip ``` -------------------------------- ### Install PyFunceble from GitHub Source Source: https://github.com/funilrys/pyfunceble/blob/dev/README.md Installs PyFunceble from a GitHub archive. Replace {{branch}} with the desired branch name (e.g., master or dev). ```shell pip3 install --user https://github.com/funilrys/PyFunceble/archive/{{branch}}.zip # From Github ``` -------------------------------- ### Install PyFunceble-dev via AUR Helper Source: https://github.com/funilrys/pyfunceble/blob/dev/docs/use/installation.md Install the PyFunceble-dev package using an AUR helper on Arch Linux. ```shell aur-helper -S pyfunceble-dev ``` -------------------------------- ### Test PyFunceble Execution Source: https://github.com/funilrys/pyfunceble/wiki/Installation After setting up the configuration, execute PyFunceble to verify the installation. Successful execution will show no output or exceptions. ```shell $ ./PyFunceble.py ``` -------------------------------- ### Platform Configuration Example Source: https://github.com/funilrys/pyfunceble/blob/dev/docs/use/configuration/parameters/platform.md Configure PyFunceble's interaction with the platform, including enabling dataset pushes and setting preferred status origins. Ensure a valid API token is set in the environment variable PYFUNCEBLE_PLATFORM_API_TOKEN for the push functionality to work. ```yaml platform: push: no preferred_status_origin: recommended checker_priority: - none checker_exclude: - none ``` -------------------------------- ### Install PyFunceble Manually from AUR Source: https://github.com/funilrys/pyfunceble/blob/dev/docs/use/installation.md Build and install the PyFunceble package manually from the Arch User Repository. ```shell git clone https://aur.archlinux.org/pyfunceble.git pyfunceble cd pyfunceble makepkg -fsri ``` -------------------------------- ### Install PyFunceble from GitLab Source Source: https://github.com/funilrys/pyfunceble/blob/dev/docs/use/installation.md Use this command to install PyFunceble from its GitLab repository. Ensure you replace {{branch}} with the desired branch name (e.g., master). ```shell # From GitLab pip3 install --upgrade --user https://gitlab.com/funilrys/PyFunceble/-/archive/{{branch}}/PyFunceble-{{branch}}.zip ``` -------------------------------- ### Install PyFunceble from GitHub Source: https://github.com/funilrys/pyfunceble/blob/dev/README.md Install the stable PyFunceble package directly from its GitHub repository using pip3. This method ensures you have the latest stable release. ```shell pip3 install --user git+https://github.com/funilrys/PyFunceble.git@master#egg=PyFunceble ``` -------------------------------- ### GitLab CI/CD Configuration for PyFunceble Source: https://github.com/funilrys/pyfunceble/blob/dev/docs/use/ci-cd/gitlab-ci-cd.md This example demonstrates a typical `.gitlab-ci.yml` configuration for running PyFunceble. It sets up necessary environment variables for auto-configuration, Git credentials, and branch management. Ensure the `GL_TOKEN` secret environment variable is defined in your GitLab project's CI/CD settings. ```yaml image: python:latest variables: # Let PyFunceble know that it has to manage the configuration by itself. PYFUNCEBLE_AUTO_CONFIGURATION: "YES" # This is the Git name we have to set. (git config user.name) GIT_EMAIL: "foobar@example.org" # This is the Git Email we have to set. (git config user.email) GIT_NAME: "PyFunceble @ GitLab CI/CD" # Define the branch PyFunceble has to use while working. GIT_BRANCH: my-awesome-branch # Define the branch PyFunceble will push the final result into. GIT_DISTRIBUTION_BRANCH: my-awesome-branch # Define the path of the configuration directory. PYFUNCEBLE_CONFIG_DIR: "${CI_PROJECT_DIR}/.pyfunceble" before_script: - pip3 install pyfunceble-dev run: script: - pyfunceble --version # Warning: this assume that the test.list file is at the root of the # repository. - pyfunceble -a --ci --logging-level critical -f test.list ``` -------------------------------- ### Install PyFunceble from GitLab Source Source: https://github.com/funilrys/pyfunceble/blob/dev/README.md Installs PyFunceble from a GitLab archive. Replace {{branch}} with the desired branch name (e.g., master or dev). ```shell pip3 install --user https://gitlab.com/funilrys/PyFunceble/-/archive/{{branch}}/PyFunceble-{{branch}}.zip # From GitLab ``` -------------------------------- ### Install PyFunceble-dev from GitLab Source: https://github.com/funilrys/pyfunceble/blob/dev/README.md Install the development version of PyFunceble from its GitLab repository using pip3. This is an alternative to GitHub for accessing the latest development patches. ```shell pip3 install --user git+https://gitlab.com/funilrys/PyFunceble.git@dev#egg=PyFunceble-dev ``` -------------------------------- ### Syntax of a domain using the API Source: https://github.com/funilrys/pyfunceble/blob/dev/docs/develop/examples/domain-syntax.md Demonstrates how to use the DomainSyntaxChecker to check a domain's syntax and status. Includes methods for setting the subject, getting the status, and converting the status to JSON or a dictionary. Also shows how to query the validity of the domain. ```python from PyFunceble import DomainSyntaxChecker checker = DomainSyntaxChecker() to_test = "github.com" # You can do it this way. status = checker.set_subject(to_test).get_status() # Or this way. checker.set_subject(to_test) status = checker.get_status() # We can convert the status to json. status_json = status.to_json() # We can convert the status to dict. status_dict = status.to_dict() # We can ask "questions". print(f"Is {to_test} VALID ?", "yes" if status.is_valid() else "no") print(f"Is {to_test} INVALID ?", "yes" if status.is_invalid() else "no") ``` -------------------------------- ### PyFunceble Domain Testing Loop Source: https://github.com/funilrys/pyfunceble/wiki/Usage This example shows how to loop through a list of domains, test each one using PyFunceble, and process actions based on their status. It highlights the use of PyFunceble().test() for script usage and requires importing the 'test' function. ```python from PyFunceble import test as PyFunceble DOMAINS = [ 'twitter.com', 'google.com', 'github.com', 'github.comcomcom', 'funilrys.co'] def domain_status(domain_or_ip): """ Check the status of the given domain name or IP. :param domain_or_ip: A string, the domain or IPv4 address to test. """ return PyFunceble(domain_or_ip) for domain in DOMAINS: print('%s is %s' % (domain, domain_status(domain))) ``` -------------------------------- ### User-Agent Configuration Example Source: https://github.com/funilrys/pyfunceble/blob/dev/docs/use/configuration/parameters/user-agent.md This YAML snippet shows how to configure PyFunceble to use a specific browser and platform for User-Agents. It also demonstrates setting a custom User-Agent string, which overrides browser and platform settings. ```yaml user_agent: # Provides everything related to choice of user agent. # Set the browser to pickup. # # WARNING: # This parameter will be deprecated (soon?). # # Available Values: chrome, edge, firefox, ie, opera, safari browser: chrome # Set the platform to pickup. # # Available Values: linux, macosx, win10 platform: linux # Set the User-Agent to use. # # WARNING: # If you choose to set this argument, the browser or platform arguments # won't be taken into consideration. # # CLI Argument: -ua | --user-agent custom: null # Set the reference to add to the User-Agent. # This is useful when you want to add a reference (e.g. a link) to the User-Agent. # # The reference will be added at the end of the User-Agent in the following format: # {user_agent}; +{reference} # # When set to `null`, no reference will be added. # # CLI Argument: --user-agent-reference reference: null ``` -------------------------------- ### Loop Through Domains with PyFunceble Source: https://github.com/funilrys/pyfunceble/wiki/Usage This example shows how to iterate over a list of domains, test each one using PyFunceble, and print its status. The function `domain_status` utilizes PyFunceble().test() for checking each domain. ```python from PyFunceble import PyFunceble DOMAINS = [ 'twitter.com', 'google.com', 'github.com', 'github.comcomcom', 'funilrys.co'] def domain_status(domain_or_ip): """ Check the status of the given domain name or IP. :param domain_or_ip: A string, the domain or IPv4 address to test. """ return PyFunceble(domain_or_ip).test() for domain in DOMAINS: print('%s is %s' % (domain, domain_status(domain))) ``` -------------------------------- ### Check Domain Syntax Inline Source: https://github.com/funilrys/pyfunceble/blob/dev/docs/use/examples/syntax.md Use the `-d` argument with `--syntax` to check a single domain's syntax. Ensure PyFunceble is installed and accessible in your PATH. ```sh pyfunceble -d github.com --syntax ``` -------------------------------- ### Share Logs Configuration Example Source: https://github.com/funilrys/pyfunceble/blob/dev/docs/use/configuration/parameters/share-logs.md This configuration snippet shows the `share_logs` parameter set to 'no'. Note that this parameter is not implemented and is reserved for future usage. ```yaml # Not Implemented yet. Reserved for future usage and implementation. share_logs: no ``` -------------------------------- ### Pull PyFunceble Docker Image Source: https://github.com/funilrys/pyfunceble/blob/dev/README.md Use this command to pull the latest stable PyFunceble Docker image from Docker Hub. This is a quick way to get started with the latest release. ```shell docker pull pyfunceble/pyfunceble ``` -------------------------------- ### Install PyFunceble on Arch Linux Source: https://github.com/funilrys/pyfunceble/blob/dev/README.md Install the PyFunceble package on Arch Linux using an AUR helper. After installation, you can verify the version. ```shell aur-helper -S pyfunceble pyfunceble --version ``` -------------------------------- ### Install PyFunceble from GitLab Source: https://github.com/funilrys/pyfunceble/blob/dev/README.md Install the stable PyFunceble package directly from its GitLab repository using pip3. This is an alternative to GitHub for installing the latest stable release. ```shell pip3 install --user git+https://gitlab.com/funilrys/PyFunceble.git@master#egg=PyFunceble ``` -------------------------------- ### Initialize Domain Availability Checker Source: https://github.com/funilrys/pyfunceble/blob/dev/docs/develop/getting-started.md Instantiate the DomainAvailabilityChecker to begin testing domain statuses. This is the first step before setting a subject. ```python from PyFunceble import from PyFunceble import Domain checker = DomainAvailabilityChecker() ``` -------------------------------- ### Generate Files Using PyFunceble API Source: https://github.com/funilrys/pyfunceble/blob/dev/docs/develop/examples/file-generation.md This snippet shows how to initiate PyFunceble's configuration, set up the producer process, and test domains to generate files. It requires manual initialization of the colorama library and configuration loading. The process involves restoring directory structure, checking domain availability, and pushing results to the producer queue for file generation. ```python import copy import colorama import PyFunceble.facility import PyFunceble.storage from PyFunceble import DomainAvailabilityChecker from PyFunceble.cli.filesystem.dir_structure.restore import \ DirectoryStructureRestoration from PyFunceble.cli.processes.producer import ProducerProcessesManager from PyFunceble.cli.utils import ascii_logo # We initiate the coloration. colorama.init(autoreset=True) # We are in control, so we need to manually start the loader. PyFunceble.facility.ConfigLoader.custom_config = { "cli_testing": { "file_generation": {"plain": True}, "display_mode": {"quiet": True, "color": True}, } } PyFunceble.facility.ConfigLoader.start() print(ascii_logo.get_home_representation()) # This is needed as our idea is to communicate with the producer process instead # of trying to implement everything again. # So, this describes the dataset as they are sent to the tester process # (normally from the CLi). STD_COMMUNICATION_DATASET = { "type": "single", "subject_type": "domain", # Destination inside the output directory. "destination": "my_awesome_pyfunceble_wrapper", "subject": None, "idna_subject": None, "source": "my_awesome_pyfunceble_wrapper", "output_dir": None, # Will be handled automatically "checker_type": "AVAILABILITY", # Must be one of our supported one!! } DOMAINS = ["github.com", "twitter.com", "www.аррӏе.com"] # In this example, we are cleaning up and regenerating the output directory # at each run. # # Note: the backup in question is the "dir_structure.json" file. dir_structure_restoration = DirectoryStructureRestoration( parent_dirname=STD_COMMUNICATION_DATASET["destination"] ).restore_from_backup() # We start the producer process. producer_proc = ProducerProcessesManager() # We start the process manager now that we are ready. producer_proc.start() # We start and configure our availability checker. avail_checker = DomainAvailabilityChecker(use_whois_lookup=False) for domain in DOMAINS: # We loop through our list of subject to test. # We parse the current subject to the availability checker. avail_checker.subject = domain # Now we fetch the status object. test_result = avail_checker.get_status() dict_result = test_result.to_dict() # We prepare our communication dataset. communication_dataset = copy.deepcopy(STD_COMMUNICATION_DATASET) communication_dataset = { key: dict_result.get(key, value) for key, value in communication_dataset.items() } # We print the result (for us as we call this script.) print( f"{test_result.subject} (IDNA: {test_result.idna_subject}) " f"is {test_result.status}" ) # We order the generation of the status file by putting our information # to the producer queue. producer_proc.push_to_input_queue( (communication_dataset, test_result), worker_name="main" ) # We are now done, it's time to send the stop signal. # The stop signal will inform the producer process that it needs to stop # listening to new order (from the time it reads the stop signal). producer_proc.push_stop_signal() # Now we wait until it's done. producer_proc.terminate() # From here all files were generated we can do whatever we want with them. ``` -------------------------------- ### Install PyFunceble-dev Manually from AUR Source: https://github.com/funilrys/pyfunceble/blob/dev/docs/use/installation.md Build and install the PyFunceble-dev package manually from the Arch User Repository. ```shell git clone https://aur.archlinux.org/pyfunceble-dev.git pyfunceble-dev cd pyfunceble-dev makepkg -fsri ``` -------------------------------- ### Switch verify_ssl_certificate via CLI Source: https://github.com/funilrys/pyfunceble/blob/dev/docs/use/configuration/parameters/index.md Demonstrates how to use the CLI argument to switch the 'verify_ssl_certificates' parameter. If set to 'yes' in the config, using the CLI flag will set it to 'no'. ```shell pyfunceble --verify-ssl-certificate -d example.org ``` -------------------------------- ### Check PyFunceble Version Source: https://github.com/funilrys/pyfunceble/blob/dev/CONTRIBUTING.md Verifies that PyFunceble is installed and accessible by checking its version. ```shell pyfunceble --version ``` -------------------------------- ### Check IP Availability using API Source: https://github.com/funilrys/pyfunceble/blob/dev/docs/develop/examples/ip-availability.md Demonstrates how to check the availability of an IP address using the IPAvailabilityChecker class. Shows multiple ways to set the subject and retrieve the status, convert it to JSON or a dictionary, and check specific status conditions. ```python from PyFunceble import IPAvailabilityChecker checker = IPAvailabilityChecker() to_test = "192.0.2.1" # You can do it this way. status = checker.set_subject(to_test).get_status() # Or this way. checker.set_subject(to_test) status = checker.get_status() # We can convert the status to json. status_json = status.to_json() # We can convert the status to dict. status_dict = status.to_dict() # We can ask "questions". print(f"Is {to_test} ACTIVE ?", "yes" if status.is_active() else "no") print(f"Is {to_test} INACTIVE ?", "yes" if status.is_inactive() else "no") print(f"Is {to_test} INVALID ?", "yes" if status.is_invalid() else "no") ``` -------------------------------- ### Set verify_ssl_certificates to yes Source: https://github.com/funilrys/pyfunceble/blob/dev/docs/use/configuration/parameters/index.md Example of setting the 'verify_ssl_certificates' parameter to 'yes' in the PyFunceble configuration file. ```yaml verify-ssl-certificates: yes ``` -------------------------------- ### Run PyFunceble Docs with Docker Source: https://github.com/funilrys/pyfunceble/blob/dev/README.md Use this command to run the PyFunceble documentation locally using Docker. Access the documentation via http://localhost:8080. ```shell docker run -it -p 8080:80 pyfunceble/docs # Open Documentation with browser: http://localhost:8080 palemoon http://127.0.0.1:8000 ``` -------------------------------- ### FileNotFoundError Example Source: https://github.com/funilrys/pyfunceble/wiki/Installation This traceback illustrates the error that occurs if the 'config.yaml' file is not created before running PyFunceble. ```python Traceback (most recent call last): File "./PyFunceble.py", line 3268, in 'config.yaml').read()) File "./PyFunceble.py", line 3095, in read with open(self.file, 'r', encoding="utf-8") as file: FileNotFoundError: [Errno 2] No such file or directory: '/home/PyFunceble/config.yaml' ``` -------------------------------- ### Display Dockerized PyFunceble Help Source: https://github.com/funilrys/pyfunceble/blob/dev/README.md Shows the help message for PyFunceble when run via its Docker image. Append '-dev' to use the development image. ```shell docker run -it pyfunceble/pyfunceble[-dev] --help ``` -------------------------------- ### Syntax Checker Response Source: https://github.com/funilrys/pyfunceble/blob/dev/docs/develop/checker-responses.md Example JSON response from the Syntax checker. This response indicates whether a subject passed the syntax validation. ```json { "checker_type": "SYNTAX", "idna_subject": "example.com", "params": null, "status": "VALID", "status_source": "SYNTAX", "subject": "example.com", "tested_at": "2021-03-09T17:43:24.477977" } ``` -------------------------------- ### URL Syntax Checking with PyFunceble API Source: https://github.com/funilrys/pyfunceble/blob/dev/docs/develop/examples/url-syntax.md Demonstrates how to initialize URLSyntaxChecker, set a subject URL, retrieve its status, and convert the status to JSON or a dictionary. It also shows how to query if the URL is valid or invalid. ```python from PyFunceble import URLSyntaxChecker checker = URLSyntaxChecker() to_test = "https://github.com/pyfunceble" # You can do it this way. status = checker.set_subject(to_test).get_status() # Or this way. checker.set_subject(to_test) status = checker.get_status() # We can convert the status to json. status_json = status.to_json() # We can convert the status to dict. status_dict = status.to_dict() # We can ask "questions". print(f"Is {to_test} VALID ?", "yes" if status.is_valid() else "no") print(f"Is {to_test} INVALID ?", "yes" if status.is_invalid() else "no") ``` -------------------------------- ### Get Domain Status Source: https://github.com/funilrys/pyfunceble/blob/dev/docs/develop/getting-started.md Retrieve the status object for the configured subject. This object contains detailed information about the domain's availability. ```python from PyFunceble import from PyFunceble import Domain checker = DomainAvailabilityChecker() checker.set_subject("github.com") # This is the same. checker.subject = "github.com" status = checker.get_status() ``` -------------------------------- ### Update pyfunceble-dev via pip Source: https://github.com/funilrys/pyfunceble/blob/dev/docs/use/update.md Use this command to update the pyfunceble-dev package using pip. The `--user` flag is recommended for user-level installation. ```shell pip3 install --user --upgrade pyfunceble-dev ``` -------------------------------- ### PyFunceble Complete Output Source: https://github.com/funilrys/pyfunceble/blob/dev/docs/use/getting-started.md Enable the complete output format using the -a or --all arguments to see all available details, including expiration dates and registrar information. ```sh pyfunceble -a -d github.com [...] Subject Status Source Expiration Date Registrar HTTP Code Checker ---------------------------------------------------------------------------------------------------- ----------- ---------- ----------------- ------------------------------ ---------- ------------- github.com ACTIVE WHOIS 09-oct-2024 MarkMonitor Inc. 301 AVAILABILITY ```