PyFunceble/url.py
def get(cls):  # pragma: no cover
        """
        Execute the logic behind the URL handling.

        :return: The status of the URL.
        :rtype: str
        """

        if Check().is_url_valid() or PyFunceble.CONFIGURATION["local"]:
            # * The url is valid.
            # or
            # * We are testing in/for a local or private network.

            if "current_test_data" in PyFunceble.INTERN:
                PyFunceble.INTERN["current_test_data"]["url_syntax_validation"] = True

            # We initiate the HTTP status code.
            PyFunceble.INTERN.update({"http_code": HTTPCode().get()})

            # We initiate the list of active status code.
            active_list = []
            active_list.extend(PyFunceble.HTTP_CODE["list"]["potentially_up"])
            active_list.extend(PyFunceble.HTTP_CODE["list"]["up"])

            # We initiate the list of inactive status code.
            inactive_list = []
            inactive_list.extend(PyFunceble.HTTP_CODE["list"]["potentially_down"])
            inactive_list.append("*" * 3)

            if PyFunceble.INTERN["http_code"] in active_list:
                # The extracted HTTP status code is in the list of active list.

                # We handle and return the up status.
                return URLStatus(PyFunceble.STATUS["official"]["up"]).handle()

            if PyFunceble.INTERN["http_code"] in inactive_list:
                # The extracted HTTP status code is in the list of inactive list.

                # We handle and return the down status.
                return URLStatus(PyFunceble.STATUS["official"]["down"]).handle()

        # The extracted HTTP status code is not in the list of active nor invalid list.

        if "current_test_data" in PyFunceble.INTERN:
            # The end-user want more information whith his test.

            # We update the url_syntax_validation index.
            PyFunceble.INTERN["current_test_data"]["url_syntax_validation"] = False

        # We handle and return the invalid down status.
        return URLStatus(PyFunceble.STATUS["official"]["invalid"]).handle()
def get(cls):  # pragma: no cover
        if Check().is_url_valid() or PyFunceble.CONFIGURATION["local"]:
            # * The url is valid.
            # or
            # * We are testing in/for a local or private network.

            if "current_test_data" in PyFunceble.INTERN:
                PyFunceble.INTERN["current_test_data"]["url_syntax_validation"] = True

            # We initiate the HTTP status code.
            PyFunceble.INTERN.update({"http_code": HTTPCode().get()})

            # We initiate the list of active status code.
            active_list = []
            active_list.extend(PyFunceble.HTTP_CODE["list"]["potentially_up"])
            active_list.extend(PyFunceble.HTTP_CODE["list"]["up"])

            # We initiate the list of inactive status code.
            inactive_list = []
            inactive_list.extend(PyFunceble.HTTP_CODE["list"]["potentially_down"])
            inactive_list.append("*" * 3)

            if PyFunceble.INTERN["http_code"] in active_list:
                # The extracted HTTP status code is in the list of active list.

                # We handle and return the up status.
                return URLStatus(PyFunceble.STATUS["official"]["up"]).handle()

            if PyFunceble.INTERN["http_code"] in inactive_list:
                # The extracted HTTP status code is in the list of inactive list.

                # We handle and return the down status.
                return URLStatus(PyFunceble.STATUS["official"]["down"]).handle()

        # The extracted HTTP status code is not in the list of active nor invalid list.

        if "current_test_data" in PyFunceble.INTERN:
            # The end-user want more information whith his test.

            # We update the url_syntax_validation index.
            PyFunceble.INTERN["current_test_data"]["url_syntax_validation"] = False

        # We handle and return the invalid down status.
        return URLStatus(PyFunceble.STATUS["official"]["invalid"]).handle()
def get ( cls ) : # pragma: no cover if Check ( ) . is_url_valid ( ) or PyFunceble . CONFIGURATION [ "local" ] : # * The url is valid. # or # * We are testing in/for a local or private network. if "current_test_data" in PyFunceble . INTERN : PyFunceble . INTERN [ "current_test_data" ] [ "url_syntax_validation" ] = True # We initiate the HTTP status code. PyFunceble . INTERN . update ( { "http_code" : HTTPCode ( ) . get ( ) } ) # We initiate the list of active status code. active_list = [ ] active_list . extend ( PyFunceble . HTTP_CODE [ "list" ] [ "potentially_up" ] ) active_list . extend ( PyFunceble . HTTP_CODE [ "list" ] [ "up" ] ) # We initiate the list of inactive status code. inactive_list = [ ] inactive_list . extend ( PyFunceble . HTTP_CODE [ "list" ] [ "potentially_down" ] ) inactive_list . append ( "*" * 3 ) if PyFunceble . INTERN [ "http_code" ] in active_list : # The extracted HTTP status code is in the list of active list. # We handle and return the up status. return URLStatus ( PyFunceble . STATUS [ "official" ] [ "up" ] ) . handle ( ) if PyFunceble . INTERN [ "http_code" ] in inactive_list : # The extracted HTTP status code is in the list of inactive list. # We handle and return the down status. return URLStatus ( PyFunceble . STATUS [ "official" ] [ "down" ] ) . handle ( ) # The extracted HTTP status code is not in the list of active nor invalid list. if "current_test_data" in PyFunceble . INTERN : # The end-user want more information whith his test. # We update the url_syntax_validation index. PyFunceble . INTERN [ "current_test_data" ] [ "url_syntax_validation" ] = False # We handle and return the invalid down status. return URLStatus ( PyFunceble . STATUS [ "official" ] [ "invalid" ] ) . handle ( )
Execute the logic behind the URL handling.

        :return: The status of the URL.
        :rtype: str
Execute the logic behind the URL handling .