Python - ftplib.FTP_TLS Port

Can someone help me confirm the default port when using ftplib.FTP_TLS? We have opened port 990 and 21 but my script fails to connect.

import ftplib

session = ftplib.FTP_TLS('xxx.ftp.com','user','password')
file = open('Bkup.tar.gz','rb')
session.storbinary('STOR Bkup.tar.gz', file)
file.close()
session.quit()

Thank You!

Answers


You could try:

ftplib.FTP_TLS.port = 21

According to it's own documentation, as well as the spec, FTPS (or FTP over TLS) connects to port 21.

You appear to be missing a login clause to authenticate the session.

Try calling session.login() followed by session.prot_p() before attempting to store the binary.

This documentation can be found by using the help function or in the online documentation here.

I hope that helps.


Need Your Help

how to escape key words in c#?

c# vb.net lambda

I want to do the equivalent of the following VB in c#