Skip to content

Client.ensure_available() should actually check if a client connection is possible (and authentication) #126

@tkoller-averbis

Description

@tkoller-averbis

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

  1. If the URL actually corresponds to a Health Discovery service
  2. 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

  1. The server is unavailable
  2. The server is not a health discovery server
  3. The API Token is invalid

With a corresponding informative error message!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions