Is your feature request related to a problem? Please describe.
As the first step of my client logic, I typically establish a client connection with the server, which I would like to verify immediately via client.ensure_available(). Unfortunately, ensure_available only sends a get request to the URL without checking
- If the URL actually corresponds to a Health Discovery service
- If the provided API Token is valid at all (irrespective of user priviliges)
E.g.:
HD_URL = "https://www.google.com/"
API_TOKEN = "Definitely not a valid API Token"
client = Client(HD_URL, api_token=API_TOKEN)
client.ensure_available()
does not throw an error and hence does not really provide utility in verifying that the client is available.
Describe the solution you'd like
Client.ensure_available should send a get request to URL + "/rest/v1/buildInfo" and ideally throw an error when either
- The server is unavailable
- The server is not a health discovery server
- The API Token is invalid
With a corresponding informative error message!