2012-02-10 77 views
0

另一个代理我碰到一个使用扭曲这个简单的代理例子就是:简单的代理需要与扭曲

# Copyright (c) Twisted Matrix Laboratories. 
# See LICENSE for details. 

from twisted.internet import reactor 
from twisted.web import proxy, server 

site = server.Site(proxy.ReverseProxyResource('yahoo.com', 80, '')) 
reactor.listenTCP(8080, site) 
reactor.run() 

的问题是,我的计算机需要使用代理服务器本身来访问网络,所以我在想,如果有一种方法可以指定这些代理设置?

回答

0

不是。至少,用Twisted做这件事并不容易。

ReverseProxyResource代表ReverseProxyRequest代表direct TCP connection到指定的主机(在这种情况下,yahoo.com)。

你可能可能修改ReverseProxyRequest以使用twisted.web.client.ProxyAgent来凑齐一些东西。可以说,扭曲本身应该提供一种方式来由代理参数化ReverseProxyResource