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
UnauthenticatedErrorbefore any requests are made if the instance’sis_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]