code: def request(self, method, url, **kwargs):
          
          resp = super(CookieSession, self).request(method, url, **kwargs)
  
          if not self._auto_renew:
              return resp
  
          is_expired = any((
              resp.status_code == 403 and
              response_to_json_dict(resp).get('error') == 'credentials_expired',
              resp.status_code == 401
          ))
  
          if is_expired:
              self.login()
              resp = super(CookieSession, self).request(method, url, **kwargs)
  
          return resp
docs: Overrides ``requests.Session.request`` to renew the cookie and then
          retry the original request (if required).