from ftplib import FTP_TLS

class implicit_ftp(FTP_TLS):
    def __init__(self):
        FTP_TLS.__init__(self, '', '', '', '', None, None, None, 60)

    def connect(self, user, pw, timeout=-999):
        self.host = 'myhost.com'
        self.port = 990
            
        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('r')
            self.welcome = self.getresp()
            self.login(user=user, passwd=pw)
            self.prot_p()
        except Exception as e:
            print (e)

        return self.welcome

'python' 카테고리의 다른 글

구구단 - 파이썬  (0) 2023.06.03
How do I add comments to JSON ?  (0) 2022.09.24
Python package install ( offline )  (0) 2022.09.24
Python Install ( linux )  (0) 2022.09.24

+ Recent posts