def requires_auth(func):
    """Decorator for :class:`TVDBClient` methods that require authentication"""
    @wraps(func)
    def wrapper(self, *args, **kwargs):
        if self.token is None or self.token_expired:
            self.login()
        elif self.token_needs_refresh:
            self.refresh_token()
        return func(self, *args, **kwargs)
    return wrapper
def requires_auth ( func ) : @ wraps ( func ) def wrapper ( self , * args , ** kwargs ) : if self . token is None or self . token_expired : self . login ( ) elif self . token_needs_refresh : self . refresh_token ( ) return func ( self , * args , ** kwargs ) return wrapper
Decorator for :class:`TVDBClient` methods that require authentication