I want to access an ftp server, anonymous, for download only. My company has proxies, and the ftp (21) ports are blocked. I cannot access the ftp server directly.
What I want to do is write code that behaves exactly like browsers do. The idea is that if I can upload files using my browser, there is a way to do this with code.
My code works when I try to access a website outside the company, but still does not work for ftp servers.
proxy = urllib2.ProxyHandler({'https': 'proxy.mycompanhy.com:8080',
'http': 'proxy.mycompanhy.com:80',
'ftp': 'proxy.mycompanhy.com:21' })
auth = urllib2.HTTPBasicAuthHandler()
opener = urllib2.build_opener(proxy, auth, urllib2.HTTPHandler)
urllib2.install_opener(opener)
urlAddress = 'https://python.org'
conn = urllib2.urlopen(urlAddress)
return_str = conn.read()
print return_str
python.org, . install_opener, , , -.
URL- ftp, ( , ).
, ftp http - .
, ftp-.
, , , http ftp, html; , - , ftp .
ftp ( URL-) . , urllib2 ftp://... 21.