Good day!

Tell me how to connect to an FTP server through a proxy server? Without a proxy, I connect via ftplib, and everything works fine. Maybe to work through a proxy use pycurl or some other module?

Thank!

#!/usr/bin/env python from ftplib import FTP #----Load file from FTP server---------------- def GetFile(ftp,files): folder = '/home/ivb/Bases/' for f in files: print '********************' print 'Download the file: %s' % f ftp.retrbinary('RETR ' + f, open(folder + f,'wb').write) ftp.quit() ftp = FTP('92.126.x.x') ftp.login('USER','PASS') ftp.cwd('/Share/Base') files = ['ASDNR.backup','ahov.backup','Doc.backup','si.backup', 'gar.backup','Navsys.backup','Tablchs.backup','Report_MCHS.backup'] GetFile(ftp,files) 
  • Well, probably use something else, for example urllib2 - alexlz
  • @Ivan Babintsev, To format the code, select it with the mouse and click on the button 101010 of the editor. - mantigatos

1 answer 1

I encountered a similar problem, solved it using this: https://code.google.com/p/socksipy-branch/ , and later found (but did not check) https://github.com/Anorov/PySocks

PS sorry for necroposting :)