src/OpenSSL/SSL.py
def set_verify(self, mode, callback):
        """
        et the verification flags for this Context object to *mode* and specify
        that *callback* should be used for verification callbacks.

        :param mode: The verify mode, this should be one of
            :const:`VERIFY_NONE` and :const:`VERIFY_PEER`. If
            :const:`VERIFY_PEER` is used, *mode* can be OR:ed with
            :const:`VERIFY_FAIL_IF_NO_PEER_CERT` and
            :const:`VERIFY_CLIENT_ONCE` to further control the behaviour.
        :param callback: The Python callback to use.  This should take five
            arguments: A Connection object, an X509 object, and three integer
            variables, which are in turn potential error number, error depth
            and return code. *callback* should return True if verification
            passes and False otherwise.
        :return: None

        See SSL_CTX_set_verify(3SSL) for further details.
        """
        if not isinstance(mode, integer_types):
            raise TypeError("mode must be an integer")

        if not callable(callback):
            raise TypeError("callback must be callable")

        self._verify_helper = _VerifyHelper(callback)
        self._verify_callback = self._verify_helper.callback
        _lib.SSL_CTX_set_verify(self._context, mode, self._verify_callback)
def set_verify(self, mode, callback):
        """
        et the verification flags for this Context object to *mode* and specify
        that *callback* should be used for verification callbacks.

        :param mode: The verify mode, this should be one of
            :const:`VERIFY_NONE` and :const:`VERIFY_PEER`. If
            :const:`VERIFY_PEER` is used, *mode* can be OR:ed with
            :const:`VERIFY_FAIL_IF_NO_PEER_CERT` and
            :const:`VERIFY_CLIENT_ONCE` to further control the behaviour.
        :param callback: The Python callback to use.  This should take five
            arguments: A Connection object, an X509 object, and three integer
            variables, which are in turn potential error number, error depth
            and return code. *callback* should return True if verification
            passes and False otherwise.
        :return: None

        See SSL_CTX_set_verify(3SSL) for further details.
        """
        if not isinstance(mode, integer_types):
            raise TypeError("mode must be an integer")

        if not callable(callback):
            raise TypeError("callback must be callable")

        self._verify_helper = _VerifyHelper(callback)
        self._verify_callback = self._verify_helper.callback
        _lib.SSL_CTX_set_verify(self._context, mode, self._verify_callback)
et the verification flags for this Context object to *mode* and specify
        that *callback* should be used for verification callbacks.

        :param mode: The verify mode, this should be one of
            :const:`VERIFY_NONE` and :const:`VERIFY_PEER`. If
            :const:`VERIFY_PEER` is used, *mode* can be OR:ed with
            :const:`VERIFY_FAIL_IF_NO_PEER_CERT` and
            :const:`VERIFY_CLIENT_ONCE` to further control the behaviour.
        :param callback: The Python callback to use.  This should take five
            arguments: A Connection object, an X509 object, and three integer
            variables, which are in turn potential error number, error depth
            and return code. *callback* should return True if verification
            passes and False otherwise.
        :return: None

        See SSL_CTX_set_verify(3SSL) for further details.