Lukasz Szybalski added the comment:

Hello,
We are having issues usign ftplib for implicit TLS over port 990

I'm referencing a solution that states 

"For the implicit FTP TLS/SSL(defualt port 990), our client program must build 
a TLS/SSL connection right after the socket is created. But python's class 
FTP_TLS doesn't reload the connect function from class FTP. We need to fix it:"



http://stackoverflow.com/questions/12164470/python-ftp-tls-connection-issue

{{{
#ImplicityTLS.py
from ftplib import FTP_TLS
import socket
import ssl

class tyFTP(FTP_TLS):
    def __init__(self, host='', user='', passwd='', acct='', keyfile=None, 
certfile=None, timeout=60):
        FTP_TLS.__init__(self, host, user, passwd, acct, keyfile, certfile, 
timeout)
    def connect(self, host='', port=0, timeout=-999):
        if host != '':
            self.host = host
        if port > 0:
            self.port = port
        if timeout != -999:
            self.timeout = timeout

        try: 
            self.sock = socket.create_connection((self.host, self.port), 
self.timeout)
            self.af = self.sock.family
            self.sock = ssl.wrap_socket(self.sock, self.keyfile, self.certfile, 
ssl_version=ssl.PROTOCOL_TLSv1)
            self.file = self.sock.makefile('rb')
            self.welcome = self.getresp()
        except Exception as e:
            print e
        return self.welcome
}}}


Then from my main application I did this:

{{{
from ImplicityTLS import tyFTP
server = tyFTP()
server.connect(host="xxxxx", port=990)
server.login(user="yyyy", passwd="fffff")
server.prot_p()
}}}

----------
nosy: +lszyba1

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue16318>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to