5.3. auth

Authentication methods.

class axonius_api_client.auth.Model[source]

Bases: object

Abstract base class for all Authentication methods.

login()[source]

Login to API.

logout()[source]

Logout from API.

check_login()[source]

Throw exc if not login.

http

Get HttpClient object.

is_logged_in

Check if login has been called.

class axonius_api_client.auth.Mixins(http, creds, **kwargs)[source]

Bases: object

Mixins for Model.

__init__(http, creds, **kwargs)[source]

Mixins for Model.

Parameters:
  • http (http.Http) – HTTP client to use to send requests.
  • creds – Credentials used by this Auth method.
LOG = None

Logger for this object.

Type:logging.Logger
http

Get HttpClient object.

Returns:http.Http
_check_http_lock()[source]

Check HTTP client not already used by another Auth.

Raises:AuthError
_set_http_lock()[source]

Set HTTP Client auth lock.

_validate()[source]

Validate credentials.

logout()[source]

Logout from API.

check_login()[source]

Throw exc if not login.

Raises:NotLoggedIn
is_logged_in

Check if login has been called.

Returns:bool
class axonius_api_client.auth.ApiKey(http, key, secret, **kwargs)[source]

Bases: axonius_api_client.auth.Mixins, axonius_api_client.auth.Model

Authentication method using API key & API secret.

__init__(http, key, secret, **kwargs)[source]

Authenticate using API key & API secret.

Parameters:
  • http (http.Http) – HTTP client to use to send requests.
  • key (str) – API key to use in credentials.
  • secret (str) – API secret to use in credentials.
_logout()[source]

Logout from API.

login()[source]

Login to API.