PyFunceble/logs.py
def expiration_date(self, extracted):
        """
        Logs the extracted expiration date.

        :param extracted: The extracted expiration date (from WHOIS record).
        :type extracted: str
        """

        if PyFunceble.CONFIGURATION["logs"]:
            # The logs subsystem is activated.

            if PyFunceble.INTERN["referer"]:
                referer = PyFunceble.INTERN["referer"]
            else:
                referer = None

            to_write = {
                self.current_time: {
                    "domain": PyFunceble.INTERN["to_test"],
                    "expiration_date": extracted,
                    "whois_server": referer,
                }
            }

            if self.output:
                output = self.output
            else:
                output = PyFunceble.OUTPUT_DIRECTORY
                output += PyFunceble.OUTPUTS["parent_directory"]
                output += PyFunceble.OUTPUTS["logs"]["directories"]["parent"]
                output += PyFunceble.OUTPUTS["logs"]["filenames"]["date_format"]

            current_content = self._get_content(output)
            current_content.update(to_write)

            self._write_content(current_content, output)

            if PyFunceble.CONFIGURATION["share_logs"]:
                # The logs sharing is activated.

                # And we share the logs with the api.
                PyFunceble.requests.post(
                    PyFunceble.LINKS["api_date_format"],
                    data=to_write[self.current_time],
                )
def expiration_date(self, extracted):
        """
        Logs the extracted expiration date.

        :param extracted: The extracted expiration date (from WHOIS record).
        :type extracted: str
        """

        if PyFunceble.CONFIGURATION["logs"]:
            # The logs subsystem is activated.

            if PyFunceble.INTERN["referer"]:
                referer = PyFunceble.INTERN["referer"]
            else:
                referer = None

            to_write = {
                self.current_time: {
                    "domain": PyFunceble.INTERN["to_test"],
                    "expiration_date": extracted,
                    "whois_server": referer,
                }
            }

            if self.output:
                output = self.output
            else:
                output = PyFunceble.OUTPUT_DIRECTORY
                output += PyFunceble.OUTPUTS["parent_directory"]
                output += PyFunceble.OUTPUTS["logs"]["directories"]["parent"]
                output += PyFunceble.OUTPUTS["logs"]["filenames"]["date_format"]

            current_content = self._get_content(output)
            current_content.update(to_write)

            self._write_content(current_content, output)

            if PyFunceble.CONFIGURATION["share_logs"]:
                # The logs sharing is activated.

                # And we share the logs with the api.
                PyFunceble.requests.post(
                    PyFunceble.LINKS["api_date_format"],
                    data=to_write[self.current_time],
                )
Logs the extracted expiration date.

        :param extracted: The extracted expiration date (from WHOIS record).
        :type extracted: str