aiosasl/__init__.py
def initiate(self, mechanism, payload=None):
        """
        Initiate the SASL handshake and advertise the use of the given
        `mechanism`. If `payload` is not :data:`None`, it will be base64
        encoded and sent as initial client response along with the ``<auth />``
        element.

        Return the next state of the state machine as tuple (see
        :class:`SASLStateMachine` for details).
        """

        if self._state != SASLState.INITIAL:
            raise RuntimeError("initiate has already been called")

        try:
            next_state, payload = yield from self.interface.initiate(
                mechanism,
                payload=payload)
        except SASLFailure:
            self._state = SASLState.FAILURE
            raise

        next_state = SASLState.from_reply(next_state)
        self._state = next_state
        return next_state, payload
def initiate(self, mechanism, payload=None):
        """
        Initiate the SASL handshake and advertise the use of the given
        `mechanism`. If `payload` is not :data:`None`, it will be base64
        encoded and sent as initial client response along with the ``<auth />``
        element.

        Return the next state of the state machine as tuple (see
        :class:`SASLStateMachine` for details).
        """

        if self._state != SASLState.INITIAL:
            raise RuntimeError("initiate has already been called")

        try:
            next_state, payload = yield from self.interface.initiate(
                mechanism,
                payload=payload)
        except SASLFailure:
            self._state = SASLState.FAILURE
            raise

        next_state = SASLState.from_reply(next_state)
        self._state = next_state
        return next_state, payload
Initiate the SASL handshake and advertise the use of the given
        `mechanism`. If `payload` is not :data:`None`, it will be base64
        encoded and sent as initial client response along with the ``<auth />``
        element.

        Return the next state of the state machine as tuple (see
        :class:`SASLStateMachine` for details).