Python中的代理FTP应用程序 [英] Proxies in Python FTP application

查看:131
本文介绍了Python中的代理FTP应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在Python ftplib中开发一个FTP客户端。我如何添加代理支持(我见过的大多数FTP应用似乎都有)?我特别想到SOCKS代理,还有其他类型...... FTP,HTTP(甚至有可能使用HTTP代理与FTP程序?)



任何想法如何做到这一点?

解决方案

根据 this source。

取决于代理,但常见的方法是ftp到代理服务器,然后使用
目标服务器的用户名和密码。



例如对于ftp.example.com:
$ b

服务器地址:proxyserver(或者使用ftp打开proxyserver)
用户:anonymous@ftp.example.com
密码:密码

在Python代码:

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


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, but also other types... FTP, HTTP (is it even possible to use HTTP proxies with FTP program?)

Any ideas how to do it?

解决方案

As per this source.

Depends on the proxy, but a common method is to ftp to the proxy, then use the username and password for the destination server.

E.g. for ftp.example.com:

Server address: proxyserver (or open proxyserver from with ftp)
User:           anonymous@ftp.example.com
Password:       password

In Python code:

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

这篇关于Python中的代理FTP应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆