def __post_init__()

in hugegraph-python-client/src/pyhugegraph/utils/huge_config.py [0:0]


    def __post_init__(self):

        if self.graphspace and self.graphspace.strip():
            self.gs_supported = True

        else:
            try:
                response = requests.get(
                    f"http://{self.ip}:{self.port}/versions", timeout=0.5
                )
                core = response.json()["versions"]["core"]
                log.info(  # pylint: disable=logging-fstring-interpolation
                    f"Retrieved API version information from the server: {core}."
                )

                match = re.search(r"(\d+)\.(\d+)(?:\.(\d+))?(?:\.\d+)?", core)
                major, minor, patch = map(int, match.groups())
                self.version.extend([major, minor, patch])

                if major >= 3:
                    self.graphspace = "DEFAULT"
                    self.gs_supported = True
                    log.warning(
                        "graph space is not set, default value 'DEFAULT' will be used."
                    )

            except Exception as e:  # pylint: disable=broad-exception-caught
                try:
                    traceback.print_exception(e)
                    self.gs_supported = False
                except Exception:   # pylint: disable=broad-exception-caught
                    exc_type, exc_value, tb = sys.exc_info()
                    traceback.print_exception(exc_type, exc_value, tb)
                    log.warning("Failed to retrieve API version information from the server, reverting to default v1.")