def DoSimianAuth(self, interactive_user=None):
    """Do Simian authentication.

    Args:
      interactive_user: bool, optional, default based on current tty,
        True if the client user an interactive user who can be prompted
        for auth.
    Raises:
      SimianServerError: an error occurs on the server
      SimianClientError: an error occurs on the client
    """
    if interactive_user is None:
      interactive_user = os.isatty(sys.stdin.fileno())

    self._InitializeAuthClass(interactive_user)

    # Step 0 - acquire a client nonce
    self._auth1.Input()
    cn = self._auth1.Output()

    # Generate /auth URL
    auth_url = '/auth'
    if self._ca_params.ca_id:
      auth_url = '%s?ca_id=%s' % (auth_url, self._ca_params.ca_id)

    # Step 1 - send client nonce to server
    response = self.Do('POST', auth_url, {'n': cn})

    # Step 1 return - look at server message output
    if response.status != 200:
      raise SimianServerError(
          'Auth step 1: %d %s' % (response.status, response.body))

    self._auth1.Input(m=response.body)
    o = self._auth1.Output()
    if not o:
      raise SimianClientError('Auth error: %s' % (
          ' '.join(self._auth1.ErrorOutput())))

    # Step 2 - send signed message to server
    response = self.Do('POST', auth_url, {'s': o['s'], 'm': o['m']})

    # Step 2 return - verify
    if response.status != 200:
      raise SimianServerError('Auth step 2')

    # Step 3 - load response
    self._auth1.Input(t=response.body)

    if not self._auth1.AuthStateOK():
      raise SimianClientError('Auth failed: %s' % (
          ' '.join(self._auth1.ErrorOutput())))

    # Success
    sanitized_headers = response.headers.copy()
    del sanitized_headers['set-cookie']
    logging.info('headers = %s', sanitized_headers)

    tokens = response.headers.get('set-cookie', None)
    if tokens is None:
      raise SimianClientError('No token supplied on cookie')

    tokens = tokens.split(',')  # split multiple cookies
    for token in tokens:
      if token.startswith(auth.AUTH_TOKEN_COOKIE):
        self._cookie_token = token
        logging.debug('Found cookie token.')
        break

    if self._cookie_token is None:
      raise SimianClientError('No recognizable token found in cookies')
dataset/ETHPy150Open google/simian/src/simian/client/client.py/HttpsAuthClient.DoSimianAuth/original