与Polipo和Tor的Scrapyd

时间:2014-06-13 13:23:11

标签: scrapy tor scrapyd polipo

更新:我现在正在运行此命令:

scrapyd-deploy <project_name>

收到此错误:

504 Connect to localhost:8123 failed: General SOCKS server failure

我正在尝试通过scrapyd-deploy部署我的scrapy蜘蛛,以下是我使用的命令:

scrapyd-deploy -L <project_name>

我收到以下错误消息:

    Traceback (most recent call last):
  File "/usr/local/bin/scrapyd-deploy", line 269, in <module>
    main()
  File "/usr/local/bin/scrapyd-deploy", line 74, in main
    f = urllib2.urlopen(req)
  File "/usr/lib/python2.7/urllib2.py", line 127, in urlopen
    return _opener.open(url, data, timeout)
  File "/usr/lib/python2.7/urllib2.py", line 410, in open
    response = meth(req, response)
  File "/usr/lib/python2.7/urllib2.py", line 523, in http_response
    'http', request, response, code, msg, hdrs)
  File "/usr/lib/python2.7/urllib2.py", line 448, in error
    return self._call_chain(*args)
  File "/usr/lib/python2.7/urllib2.py", line 382, in _call_chain
    result = func(*args)
  File "/usr/lib/python2.7/urllib2.py", line 531, in http_error_default
    raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
urllib2.HTTPError: HTTP Error 404: Not found

以下是我的 scrapy.cfg 文件:

[settings]
default = <project_name>.settings

[deploy:<project_name>]
url = http://localhost:8123
project = <project_name>
eggs_dir    = eggs
logs_dir    = logs
items_dir   = items
jobs_to_keep = 5
dbs_dir     = dbs
max_proc    = 0
max_proc_per_cpu = 4
finished_to_keep = 100
poll_interval = 5
http_port = 8123
debug       = on
runner      = scrapyd.runner
application = scrapyd.app.application
launcher    = scrapyd.launcher.Launcher

[services]
schedule.json     = scrapyd.webservice.Schedule
cancel.json       = scrapyd.webservice.Cancel
addversion.json   = scrapyd.webservice.AddVersion
listprojects.json = scrapyd.webservice.ListProjects
listversions.json = scrapyd.webservice.ListVersions
listspiders.json  = scrapyd.webservice.ListSpiders
delproject.json   = scrapyd.webservice.DeleteProject
delversion.json   = scrapyd.webservice.DeleteVersion
listjobs.json     = scrapyd.webservice.ListJobs

我正在使用端口'http://localhost:8123'上的polipo代理运行tor和polipo。我可以执行一个wget并下载该页面而没有任何问题。代理正常工作,我可以连接到互联网等。请询问您是否需要更多说明。

谢谢!

4 个答案:

答案 0 :(得分:0)

  

urllib2.HTTPError:HTTP错误404:未找到

未到达网址。

答案 1 :(得分:0)

/var/log/polipo/polipo.log中有什么有趣的东西?什么来自tail -100 /var/log/polipo/polipo.log

答案 2 :(得分:0)

显然这是因为我忘了运行主命令。它很容易被遗漏,因为它在文档的Overview页面中提到,而不是Deployment页面。以下是命令:

scrapyd

答案 3 :(得分:0)

504 Connect to localhost:8123 failed: General SOCKS server failure

您要求Polipo连接到localhost:8123; Polipo将请求传递给tor,返回由Polipo尽职尽责地返回的失败结果(&#34; General SOCKS服务器失败&#34;)。

url = http://localhost:8123

这肯定不是你的意思。

http_port = 8123

我也非常确定你不想在与Polipo相同的端口上运行报废。