Python urllib2 Tor 514 需要身份验证
我正在尝试用Python和urllib2来使用Tor,但遇到了问题。以下是我使用的代码:
print opener.open('http://check.torproject.org/').read()
还有这段代码:
telnet 127.0.0.1 9051
但是我收到了以下错误:
514 Authentication Required.
这是我想用的代码:不过在urllib2.urlopen调用时,我还是收到了同样的514认证错误。
import urllib2
# using TOR !
proxy_support = urllib2.ProxyHandler({"http" : "127.0.0.1:9051"} )
opener = urllib2.build_opener(proxy_support)
urllib2.install_opener(opener)
# every urlopen connection will then use the TOR proxy like this one :
urllib2.urlopen('http://www.google.com').read()
有没有人能告诉我为什么会出现这个问题?
我在Tor的Vidalia浏览器中设置 -> 设置 -> 高级:认证设置为“随机生成”。
我使用的是Python 2.65和urllib2的Tor。