averbis / averbis-python-api

Conveniently access the REST API of Averbis products using Python
Apache License 2.0
12 stars 4 forks source link

Creating a client and then waiting for server start does not work #58

Closed reckart closed 3 years ago

reckart commented 3 years ago

Describe the bug The client currently tries to obtain the server version in its constructor. This defies the usage scenario of creating a client and then waiting for the server to complete booting:

client = Client("http://dummy").ensure_available()

because it won't even get to the ensure_available() due to the constructor bailing out at the end

        try:
            self.build_info = self.get_build_info()
        except JSONDecodeError:
            raise ValueError(
                "The Client could not get information about the platform. This is likely because your API Token has changed."
            )
        self.spec_version = self.build_info["specVersion"]

Expected behavior We need some way of obtaining the server version while still allowing to wait for the server to become available.