Proxies in Python FTP application

前端 未结 6 609
青春惊慌失措
青春惊慌失措 2020-12-15 11:42

I\'m developing an FTP client in Python ftplib. How do I add proxies support to it (most FTP apps I have seen seem to have it)? I\'m especially thinking about SOCKS proxies,

6条回答
  •  醉梦人生
    2020-12-15 11:57

    You can use the ProxyHandler in urllib2.

    ph = urllib2.ProxyHandler( { 'ftp' : proxy_server_url } )
    server= urllib2.build_opener( ph )
    

提交回复
热议问题