Skip to content

# Base

The tool to check the availability or syntax of domain, IP or URL.

::

    ██████╗ ██╗   ██╗███████╗██╗   ██╗███╗   ██╗ ██████╗███████╗██████╗ ██╗     ███████╗
    ██╔══██╗╚██╗ ██╔╝██╔════╝██║   ██║████╗  ██║██╔════╝██╔════╝██╔══██╗██║     ██╔════╝
    ██████╔╝ ╚████╔╝ █████╗  ██║   ██║██╔██╗ ██║██║     █████╗  ██████╔╝██║     █████╗
    ██╔═══╝   ╚██╔╝  ██╔══╝  ██║   ██║██║╚██╗██║██║     ██╔══╝  ██╔══██╗██║     ██╔══╝
    ██║        ██║   ██║     ╚██████╔╝██║ ╚████║╚██████╗███████╗██████╔╝███████╗███████╗
    ╚═╝        ╚═╝   ╚═╝      ╚═════╝ ╚═╝  ╚═══╝ ╚═════╝╚══════╝╚═════╝ ╚══════╝╚══════╝

Provides the base of all our record classes.

Author: Nissar Chababy, @funilrys, contactTATAfunilrysTODTODcom

Special thanks: https://pyfunceble.github.io/#/special-thanks

Contributors: https://pyfunceble.github.io/#/contributors

Project link: https://github.com/funilrys/PyFunceble

Project documentation: https://docs.pyfunceble.com

Project homepage: https://pyfunceble.github.io/

License: ::

    Copyright 2017, 2018, 2019, 2020, 2022, 2023, 2024, 2025 Nissar Chababy

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

        https://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.

## `RecordBase` `dataclass`

Provides the base of all query record classes.

Source code in `PyFunceble/query/record/base.py`

    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91

    @dataclasses.dataclass
    class RecordBase:
        """
        Provides the base of all query record classes.
        """

        def __getitem__(self, key: str) -> Any:
            return getattr(self, key)

        def to_dict(self) -> dict:
            """
            Provides the dict representation of the current object.
            """

            return {
                x: y if not hasattr(y, "to_dict") else y.to_dict()
                for x, y in self.__dict__.items()
                if not x.startswith("__")
            }

        def to_json(self, *, pretty_print: bool = False) -> str:
            """
            Provides the JSON representation of the current object.

            :param pretty_print:
                If True, the JSON will be formatted.
            """

            return json.dumps(
                self.to_dict(),
                indent=4 if pretty_print else None,
                ensure_ascii=False,
                sort_keys=True if pretty_print else None,
            )

### `to_dict()`

Provides the dict representation of the current object.

Source code in `PyFunceble/query/record/base.py`

    67
    68
    69
    70
    71
    72
    73
    74
    75
    76

    def to_dict(self) -> dict:
        """
        Provides the dict representation of the current object.
        """

        return {
            x: y if not hasattr(y, "to_dict") else y.to_dict()
            for x, y in self.__dict__.items()
            if not x.startswith("__")
        }

### `to_json(*, pretty_print=False)`

Provides the JSON representation of the current object.

Parameters:

Name | Type | Description | Default
--- | --- | --- | ---
`pretty_print` | `bool` | If True, the JSON will be formatted. | `False`

Source code in `PyFunceble/query/record/base.py`

    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91

    def to_json(self, *, pretty_print: bool = False) -> str:
        """
        Provides the JSON representation of the current object.

        :param pretty_print:
            If True, the JSON will be formatted.
        """

        return json.dumps(
            self.to_dict(),
            indent=4 if pretty_print else None,
            ensure_ascii=False,
            sort_keys=True if pretty_print else None,
        )