code: def check_login(func):
      
  
      @wraps(func)
      def wrapper(*args, **kwargs):
          ret = func(*args, **kwargs)
          if type(ret) == requests.Response:
              # 检测结果是否为JSON
              if ret.content[0]!=b'{' and ret.content[0]!=b'[':
                  return ret
              try:
                  foo = json.loads(ret.content.decode('utf-8'))
                  if 'errno' in foo and foo['errno'] == -6:
                      logging.debug(
                              'Offline, deleting cookies file then relogin.')
                      path = '.{0}.cookies'.format(args[0].username)
                      if os.path.exists(path):
                          os.remove(path)
                      args[0]._initiate()
              except:
                  raise LoginFailed('User unsigned in.')
          return ret
  
      return wrapper
docs: 检查用户登录状态
      :param func: 需要被检查的函数