Problems with FTP

Giampaolo Rodolà g.rodola at gmail.com
Fri Jan 21 14:32:57 EST 2011


The solution proposed on stackoverflow:

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

...can not work.
The "anonymous at ftp.download.com" part is pure fiction.
Nothing like that has ever been mentioned in any RFC or
implemented/supported by any server, as far as I know.
I'd say the only way to proxy FTP is by using a SOCKS proxy.
By looking at the error message it's likely that the company firewall
is just blocking the FTP traffic.


--- Giampaolo
http://code.google.com/p/pyftpdlib/
http://code.google.com/p/psutil/



2011/1/21 Thomas Jollans <thomas at jollybox.de>:
> On Friday 21 January 2011, it occurred to RizlaJ to exclaim:
>> Hi all, I'm very new to python. I'm using Python 2.7, in a corporate
>> environment, therefore am behind a proxy server, firewalls etc.
>>
>> I can ftp to a barclays capital ftp site ok in internet explorer, but
>> I can't get the FTP from ftplib to work for me. Can someone please
>> help!
>
> It sounds very much like, as you said, you're behind a proxy, and have to use
> that proxy to connect to the FTP server. If you don't know the proxy settings,
> you might be able to find them in the IE configuration, or ask the local
> sysadmin.
>
> http://stackoverflow.com/questions/1293518/proxies-in-python-ftp-application
>
> It looks like you will have to ftp to the proxy server. Depending on the
> application, you might be able to use urllib2 instead.
>
> Thomas
>
>>
>> I've tried the following commands from my home personal machine
>> (thefore no proxies etc) and the commands work fine and I'm able to
>> enter my username and password and login successfuly - however in teh
>> corporate environment I can't. I'm wondering if this is soemthing to
>> do with security permissioning at work etc?
>>
>> At the shell I'm typing:-
>>
>> >>> from ftplib import FTP
>> >>> ftp = FTP('indexftp.barcap.com')
>>
>> and get the following error:
>> Traceback (most recent call last):
>>   File "<pyshell#19>", line 1, in <module>
>>     ftp = FTP('indexftp.barcap.com')
>>   File "C:\Python27\lib\ftplib.py", line 117, in __init__
>>     self.connect(host)
>>   File "C:\Python27\lib\ftplib.py", line 132, in connect
>>     self.sock = socket.create_connection((self.host, self.port),
>> self.timeout)
>>   File "C:\Python27\lib\socket.py", line 571, in create_connection
>>     raise err
>> error: [Errno 10060] A connection attempt failed because the connected
>> party did not properly respond after a period of time, or established
>> connection failed because connected host has failed to respond
>>
>> I wasn't expecting this error message next, i was expecting to be able
>> to log on using the followign command :-
>>
>> >> ftp.login("username","password")
>>
>> Please help!
>>
>> thanks!
> --
> http://mail.python.org/mailman/listinfo/python-list
>



More information about the Python-list mailing list