(self, context=None)
return resp
Start a TLS session on the active connection as specified in RFC 2595.

                context - a ssl.SSLContext
Start a TLS session on the active connection as specified in RFC 2595.
Start a TLS session on the active connection as specified in RFC 2595 .
def stls(self, context=None):
        """Start a TLS session on the active connection as specified in RFC 2595.

                context - a ssl.SSLContext
        """
        if not HAVE_SSL:
            raise error_proto('-ERR TLS support missing')
        if self._tls_established:
            raise error_proto('-ERR TLS session already established')
        caps = self.capa()
        if not 'STLS' in caps:
            raise error_proto('-ERR STLS not supported by server')
        if context is None:
            context = ssl._create_stdlib_context()
        resp = self._shortcmd('STLS')
        self.sock = context.wrap_socket(self.sock,
                                        server_hostname=self.host)
        self.file = self.sock.makefile('rb')
        self._tls_established = True
        return resp
def stls ( self , context = None ) : if not HAVE_SSL : raise error_proto ( '-ERR TLS support missing' ) if self . _tls_established : raise error_proto ( '-ERR TLS session already established' ) caps = self . capa ( ) if not 'STLS' in caps : raise error_proto ( '-ERR STLS not supported by server' ) if context is None : context = ssl . _create_stdlib_context ( ) resp = self . _shortcmd ( 'STLS' ) self . sock = context . wrap_socket ( self . sock , server_hostname = self . host ) self . file = self . sock . makefile ( 'rb' ) self . _tls_established = True return resp