code: def login(method):
      
  
      def wrapper(*args, **kwargs):
          crawler = args[0].crawler  # args[0] is a NetEase object
  
          try:
              if os.path.isfile(cookie_path):
                  with open(cookie_path, 'r') as cookie_file:
                      cookie = cookie_file.read()
                  expire_time = re.compile(r'\d{4}-\d{2}-\d{2}').findall(cookie)
                  now = time.strftime('%Y-%m-%d', time.localtime(time.time()))
                  if expire_time[0] > now:
                      crawler.session.cookies.load()
                  else:
                      crawler.login()
              else:
                  crawler.login()
          except RequestException:
              click.echo('Maybe password error, please try again.')
              sys.exit(1)
          result = method(*args, **kwargs)
          return result
  
      return wrapper
docs: Require user to login.