def auth_required(func):
 def wrapper(self, *args, **kwargs):
  if (not self.is_authenticated()):
   log.debug(u'None API token. Authenticating with "%s" account...', self.credentials.get(u'username'))
   self.auth()
   assert self.is_authenticated()
  return func(self, *args, **kwargs)
 return wrapper

def auth_required ( func ) : def wrapper ( self , * args , ** kwargs ) : if ( not self . is_authenticated ( ) ) : log . debug ( u'None API token. Authenticating with "%s" account...' , self . credentials . get ( u'username' ) ) self . auth ( ) assert self . is_authenticated ( ) return func ( self , * args , ** kwargs ) return wrapper
decorator that protects enpoints through multiple mechanisms example:: @app .