【问题标题】:Tor .exit with polipo from urllib2Tor .exit 与来自 urllib2 的 polipo
【发布时间】:2012-07-26 14:16:45
【问题描述】:

我正在尝试将 Tor 与 urllib2 和 polipo 一起使用。我需要的是一种在程序运行时切换到特定出口节点的方法。 我在 /etc/tor/torrc 中设置了“AllowDotExit 1”,并尝试了以下方法:

import urllib2

proxy = '127.0.0.1'
port = '8118'

url='http://ifconfig.me.651d7ace80e0b53e6c05eb4db2491264f049df66.exit'

proxyurl = '%s:%s' % (proxy, port)
proxyhandler = urllib2.ProxyHandler({'http': proxyurl})
opener = urllib2.build_opener(proxyhandler)

page = opener.open(url)
print 'Page opened.'
print page.read()

但我得到的是:

    :!/usr/bin/env python tortest.py
Traceback (most recent call last):
  File "tortest.py", line 18, in <module>
    page = opener.open(url, timeout=20)
  File "/usr/lib/python2.7/urllib2.py", line 406, in open
    response = meth(req, response)
  File "/usr/lib/python2.7/urllib2.py", line 519, in http_response
    'http', request, response, code, msg, hdrs)
  File "/usr/lib/python2.7/urllib2.py", line 444, in error
    return self._call_chain(*args)
  File "/usr/lib/python2.7/urllib2.py", line 378, in _call_chain
    result = func(*args)
  File "/usr/lib/python2.7/urllib2.py", line 527, in http_error_default
    raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
urllib2.HTTPError: HTTP Error 504: Connect to ifconfig.me.651d7ace80e0b53e6c05eb4db2491264f049df66.exit:80 failed: General SOCKS server failure 

谁能帮我解决这个问题?

【问题讨论】:

    标签: python urllib2 tor


    【解决方案1】:

    General SOCKS server failure 可以是任何东西。例如,您的 TOR 节点可能不知道如何到达指定的出口节点。这种情况经常发生。出口可能会列在其中一个状态页面上,但仍然无法从您的 tor 节点访问。尝试其他退出,或稍后重试。通常,当您请求特定的出口节点时,需要几分钟才能通过网络建立链接。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-03-13
      相关资源
      最近更新 更多