PyFunceble/expiration_date.py
def get(self):  # pragma: no cover
        """
        Execute the logic behind the meaning of ExpirationDate + return the matched status.

        :return:
            The status of the tested domain.
            Can be one of the official status.
        :rtype: str
        """

        # We get the status of the domain validation.
        domain_validation = self.checker.is_domain_valid()
        # We get the status of the IPv4 validation.
        ip_validation = self.checker.is_ip_valid()

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

            # We update some index.
            PyFunceble.INTERN["current_test_data"].update(
                {
                    "domain_syntax_validation": domain_validation,
                    "ip4_syntax_validation": ip_validation,
                }
            )

        if (
            domain_validation
            and not ip_validation
            or domain_validation
            or PyFunceble.CONFIGURATION["local"]
        ):
            # * The element is a valid domain.
            # and
            # * The element is not ahe valid IPv4.
            # or
            # * The element is a valid domain.

            # * We get the HTTP status code of the currently tested element.
            # and
            # * We try to get the element status from the IANA database.
            PyFunceble.INTERN.update(
                {"http_code": HTTPCode().get(), "referer": Referer().get()}
            )

            if not PyFunceble.INTERN["referer"]:
                # We could not get the referer.

                # We parse the referer status into the upstream call.
                return PyFunceble.INTERN["referer"]

            # The WHOIS record status is not into our list of official status.

            if PyFunceble.INTERN["referer"] and not self.checker.is_subdomain():
                # * The iana database comparison status is not None.
                # and
                # * The domain we are testing is not a subdomain.

                # We try to extract the expiration date from the WHOIS record.
                # And we return the matched status.
                return self._extract()

            # The iana database comparison status is None.

            # We log our whois record if the debug mode is activated.
            Logs().whois(self.whois_record)

            # And we return None, we could not extract the expiration date.
            return None

        if (
            ip_validation
            and not domain_validation
            or ip_validation
            or PyFunceble.CONFIGURATION["local"]
        ):
            # * The element is a valid IPv4.
            # and
            # * The element is not a valid domain.
            # or
            # * The element is a valid IPv4.

            # We get the HTTP status code.
            PyFunceble.INTERN["http_code"] = HTTPCode().get()

            # We log our whois record if the debug mode is activated.
            Logs().whois(self.whois_record)

            # And we return None, there is no expiration date to look for.
            return None

        # The validation was not passed.

        # We log our whois record if the debug mode is activated.
        Logs().whois(self.whois_record)

        # And we return False, the domain could not pass the IP and domains syntax validation.
        return False
def get(self):  # pragma: no cover
        """
        Execute the logic behind the meaning of ExpirationDate + return the matched status.

        :return:
            The status of the tested domain.
            Can be one of the official status.
        :rtype: str
        """

        # We get the status of the domain validation.
        domain_validation = self.checker.is_domain_valid()
        # We get the status of the IPv4 validation.
        ip_validation = self.checker.is_ip_valid()

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

            # We update some index.
            PyFunceble.INTERN["current_test_data"].update(
                {
                    "domain_syntax_validation": domain_validation,
                    "ip4_syntax_validation": ip_validation,
                }
            )

        if (
            domain_validation
            and not ip_validation
            or domain_validation
            or PyFunceble.CONFIGURATION["local"]
        ):
            # * The element is a valid domain.
            # and
            # * The element is not ahe valid IPv4.
            # or
            # * The element is a valid domain.

            # * We get the HTTP status code of the currently tested element.
            # and
            # * We try to get the element status from the IANA database.
            PyFunceble.INTERN.update(
                {"http_code": HTTPCode().get(), "referer": Referer().get()}
            )

            if not PyFunceble.INTERN["referer"]:
                # We could not get the referer.

                # We parse the referer status into the upstream call.
                return PyFunceble.INTERN["referer"]

            # The WHOIS record status is not into our list of official status.

            if PyFunceble.INTERN["referer"] and not self.checker.is_subdomain():
                # * The iana database comparison status is not None.
                # and
                # * The domain we are testing is not a subdomain.

                # We try to extract the expiration date from the WHOIS record.
                # And we return the matched status.
                return self._extract()

            # The iana database comparison status is None.

            # We log our whois record if the debug mode is activated.
            Logs().whois(self.whois_record)

            # And we return None, we could not extract the expiration date.
            return None

        if (
            ip_validation
            and not domain_validation
            or ip_validation
            or PyFunceble.CONFIGURATION["local"]
        ):
            # * The element is a valid IPv4.
            # and
            # * The element is not a valid domain.
            # or
            # * The element is a valid IPv4.

            # We get the HTTP status code.
            PyFunceble.INTERN["http_code"] = HTTPCode().get()

            # We log our whois record if the debug mode is activated.
            Logs().whois(self.whois_record)

            # And we return None, there is no expiration date to look for.
            return None

        # The validation was not passed.

        # We log our whois record if the debug mode is activated.
        Logs().whois(self.whois_record)

        # And we return False, the domain could not pass the IP and domains syntax validation.
        return False
def get ( self ) : # pragma: no cover # We get the status of the domain validation. domain_validation = self . checker . is_domain_valid ( ) # We get the status of the IPv4 validation. ip_validation = self . checker . is_ip_valid ( ) if "current_test_data" in PyFunceble . INTERN : # The end-user want more information whith his test. # We update some index. PyFunceble . INTERN [ "current_test_data" ] . update ( { "domain_syntax_validation" : domain_validation , "ip4_syntax_validation" : ip_validation , } ) if ( domain_validation and not ip_validation or domain_validation or PyFunceble . CONFIGURATION [ "local" ] ) : # * The element is a valid domain. # and # * The element is not ahe valid IPv4. # or # * The element is a valid domain. # * We get the HTTP status code of the currently tested element. # and # * We try to get the element status from the IANA database. PyFunceble . INTERN . update ( { "http_code" : HTTPCode ( ) . get ( ) , "referer" : Referer ( ) . get ( ) } ) if not PyFunceble . INTERN [ "referer" ] : # We could not get the referer. # We parse the referer status into the upstream call. return PyFunceble . INTERN [ "referer" ] # The WHOIS record status is not into our list of official status. if PyFunceble . INTERN [ "referer" ] and not self . checker . is_subdomain ( ) : # * The iana database comparison status is not None. # and # * The domain we are testing is not a subdomain. # We try to extract the expiration date from the WHOIS record. # And we return the matched status. return self . _extract ( ) # The iana database comparison status is None. # We log our whois record if the debug mode is activated. Logs ( ) . whois ( self . whois_record ) # And we return None, we could not extract the expiration date. return None if ( ip_validation and not domain_validation or ip_validation or PyFunceble . CONFIGURATION [ "local" ] ) : # * The element is a valid IPv4. # and # * The element is not a valid domain. # or # * The element is a valid IPv4. # We get the HTTP status code. PyFunceble . INTERN [ "http_code" ] = HTTPCode ( ) . get ( ) # We log our whois record if the debug mode is activated. Logs ( ) . whois ( self . whois_record ) # And we return None, there is no expiration date to look for. return None # The validation was not passed. # We log our whois record if the debug mode is activated. Logs ( ) . whois ( self . whois_record ) # And we return False, the domain could not pass the IP and domains syntax validation. return False
Execute the logic behind the meaning of ExpirationDate + return the matched status.

        :return:
            The status of the tested domain.
            Can be one of the official status.
        :rtype: str
Execute the logic behind the meaning of ExpirationDate + return the matched status .