def requires_basic_auth(func):
 @wraps(func)
 def auth_wrapper(self, *args, **kwargs):
  if (hasattr(self, 'session') and self.session.auth):
   return func(self, *args, **kwargs)
  else:
   from .exceptions import error_for
   r = generate_fake_error_response('{"message": "Requires username/password authentication"}')
   raise error_for(r)
 return auth_wrapper

def requires_basic_auth ( func ) : @ wraps ( func ) def auth_wrapper ( self , * args , ** kwargs ) : if ( hasattr ( self , 'session' ) and self . session . auth ) : return func ( self , * args , ** kwargs ) else : from . exceptions import error_for r = generate_fake_error_response ( '{"message": "Requires username/password authentication"}' ) raise error_for ( r ) return auth_wrapper
specific authentication decorator .