Misc utility functions and constants

hvac.utils.deprecated_method(to_be_removed_in_version, new_method=None)[source]

This is a decorator which can be used to mark methods as deprecated. It will result in a warning being emitted when the function is used.

  • to_be_removed_in_version (str) – Version of this module the decorated method will be removed in.
  • new_method (function) – Method intended to replace the decorated method. This method’s docstrings are included in the decorated method’s docstring.

Wrapped function that includes a deprecation warning and update docstrings from the replacement method.

Return type:


hvac.utils.raise_for_error(status_code, message=None, errors=None)[source]

Helper method to raise exceptions based on the status code of a response received back from Vault.

  • status_code (int) – Status code received in a response from Vault.
  • message (str) – Optional message to include in a resulting exception.
  • errors (list | str) – Optional errors to include in a resulting exception.

hvac.exceptions.InvalidRequest | hvac.exceptions.Unauthorized | hvac.exceptions.Forbidden | hvac.exceptions.InvalidPath | hvac.exceptions.RateLimitExceeded | hvac.exceptions.InternalServerError | hvac.exceptions.VaultNotInitialized | hvac.exceptions.VaultDown | hvac.exceptions.UnexpectedError