How to connect to ftp server via proxy using ftplib????

Tim Williams listserver at tdw.net
Wed Oct 20 06:46:49 EDT 2004


----- Original Message ----- 
From: "BruceKL WhoH" <BruceWhoHKL at gawab.com>


> Hi,all
>      I am trying to write a simple ftp client, and
> I found ftplib module. But my app needs to connect to server
> via proxy, I cannot find the way to do this using ftplib .
> As we know ,most ftp client app(such as FlashFXP,CuteFtp) can connect to
ftp server via proxy.
> How to do this?
>      Please point me in the right direction. Thanks in advance.
>


Depends on the proxy,  but a common method is to ftp to the proxy,  then use
user at real-server as the user name, and the original password

EG  for ftp.download.com

ftp proxyserver  (or open proxyserver from with ftp)
user anonymous at ftp.download.com
pass xxxxx

... so

from ftplib import FTP
site = FTP('my_proxy')
site.set_debuglevel(1)
msg = site.login('anonymous at ftp.download.com', 'password')
site.cwd('/pub')

HTH

:-)





More information about the Python-list mailing list