« HTML colorsCoupons »

Monday, February 23rd, 2009

M2Crypto FTPS

Categories: Computers, Work

I have been trying a ton to find something about FTPS with python. I desperately need to automate a process that I have to manually do twice daily, and at very inconvenient hours. I finally came up with this:

from M2Crypto import ftpslib

def handleDownload(block):
    file.write(block)
    print ".",

f = ftpslib.FTP_TLS()
f.connect('ftp.server.com',21)
f.login('testaccount', 'testaccount')
f.auth_tls()
f.set_pasv(0)
file = open('localfile.txt', 'wb')
f.retrbinary('RETR test.txt', handleDownload)
file.close()
f.quit()

I'm not positive how secure it actually is, but it seems to me that M2Crypto should hold it's ground, since every internet search regarding FTPS with Python returns something about M2Crypto.

permalink 9:10pm by Brandon //comment 768 views

No feedback yet

Leave a comment


Your email address will not be revealed on this site.

Your URL will be displayed.
(Line breaks become <br />)
(Name, email & website)
(Allow users to contact you through a message form (your email will not be revealed.)

©2010 by Brandon Contact design by brandonh

Credits: framework | VPS hosting | François

visits: stats