simplelogincmd.rest.util.require_authentication

require_authentication(f)

Decorate a method to raise an error if its instance has no API key

Help to prevent bogus calls to the API by raising UnauthenticatedError before any requests are made if the instance’s is_authenticated() method returns False. Also add a note of this behavior to the decorated method’s docstring so that it is documented in only one place.

Parameters:

f (Callable[[Any], Any]) – The method to decorate

Returns:

The decorated method

Return type:

Callable[[Any], Any]