Home/Support/Support Forum/It is possible to get access to a ftp server on connectport X2 with python?
Welcome to Digi Forum, where you can ask questions and receive answers from other members of the community.

It is possible to get access to a ftp server on connectport X2 with python?

0 votes
from ftplib import FTP
ftp = FTP('ftp.server')
ftp.login('user', 'password')

print ftp.dir()
asked Dec 3, 2014 in Python by Evanior New to the Community (0 points)

Please log in or register to answer this question.

2 Answers

0 votes
I don't see why not.

Here is something with a little more detail:
try:
f = FileWrapper(buf, len(buf))

cmd = "STOR " + fname

ftp = FTP(ftpserver)
# uncomment for debug
ftp.set_debuglevel(2)
ftp.set_pasv('true')
ftp.login(ftpuser, ftppwd)

ftp.cwd(ftpdir)

ftp.storbinary(cmd, f)

ftp.quit()
ret = True
answered Dec 3, 2014 by kjensen8 Veteran of the Digi Community (623 points)
0 votes
See the samples in Digi ESP for Python. There are several FTP samples. Check readme.txt in each sample project.
answered Dec 3, 2014 by trooper2 Veteran of the Digi Community (588 points)
...