4.7.2.1. Authenticating

Authentication via API key and API secret.

class axonius_api_client.auth.api_key.AuthApiKey(http, key, secret, **kwargs)[source]

Bases: AuthModel

Authentication method using API key & API secret.

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

Authenticate using API key & API secret.

Parameters:
  • http (axonius_api_client.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

login()[source]

Login to API.

Return type:

bool

property fields: List[str]

Credential fields used by this auth model.

logout()[source]

Logout from API.

Return type:

bool

CLIENT: typing.ClassVar[typing.Any] = None

Client object to use for API calls.

LOG: typing.ClassVar[logging.Logger] = None

Logger for this object.

LOGIN_RESPONSE: typing.ClassVar[typing.Any] = None

Response from login request.

VALIDATE_RESPONSE: typing.ClassVar[typing.Any] = None

Response from validate request.

__repr__()

Show object info.

Return type:

str

__str__()

Show object info.

Return type:

str

_get_api_keys(http_args=None)

Direct API method to get the API keys for the current user.

Parameters:

http_args (typing.Optional[dict]) –

Return type:

dict

_get_current_user()

Direct API method to get the current user.

Return type:

axonius_api_client.api.json_api.account.current_user.CurrentUser

check_login()

Check if login has been called.

Raises:

NotLoggedIn – When login has not been called before trying to make a call with this Auth model.

get_api_keys()

Get the API key and secret for the current user.

Return type:

dict

get_current_user()

Get the current user.

Return type:

axonius_api_client.api.json_api.account.current_user.CurrentUser

http: typing.ClassVar[axonius_api_client.http.Http] = None

HTTP client to use to send requests.

is_logged_in: bool = False

If login has been called successfully or not.

property url: str

Get the URL used by this Auth model.

validate()

Validate credentials.

Return type:

bool