ironic_inspector_client.common.http module

Generic code for inspector client.

class ironic_inspector_client.common.http.BaseClient(api_version, inspector_url=None, session=None, service_type='baremetal-introspection', interface=None, region_name=None)[source]

Bases: object

Base class for clients, provides common HTTP code.

request(method, url, **kwargs)[source]

Make an HTTP request.

Parameters:
  • method – HTTP method

  • endpoint – relative endpoint

  • kwargs – arguments to pass to ‘requests’ library

server_api_versions()[source]

Get minimum and maximum supported API versions from a server.

Returns:

tuple (minimum version, maximum version) each version is returned as a tuple (X, Y)

Raises:

requests library exception on connection problems.

Raises:

ValueError if returned version cannot be parsed

exception ironic_inspector_client.common.http.ClientError(response)[source]

Bases: HTTPError

Error returned from a server.

classmethod raise_if_needed(response)[source]

Raise exception if response contains error.

exception ironic_inspector_client.common.http.EndpointNotFound(service_type)[source]

Bases: Exception

Denotes that endpoint for the introspection service was not found.

Variables:

service_type – requested service type

exception ironic_inspector_client.common.http.VersionNotSupported(expected, supported)[source]

Bases: Exception

Denotes that requested API versions is not supported by the server.

Variables:
  • expected – requested version.

  • supported – sequence with two items: minimum and maximum actually supported versions.