将Scrapy项目部署到远程Scrapyd服务错误

时间:2018-11-13 12:30:16

标签: scrapy scrapyd

我试图将测试Scrapy项目部署到远程Scrapyd服务器。我在客户端收到以下错误消息。

curl http://IP:6800/addversion.json -d project=test_project -d spider=quotes
{"status": "error", "message": "'version'", "node_name": "serverName"}

服务器端错误消息

2018-11-13T12:22:22+0000 [_GenericHTTPChannelProtocol,0,IP Address] Unhandled Error
    Traceback (most recent call last):
      File "/usr/lib64/python2.7/site-packages/twisted/web/http.py", line 2190, in allContentReceived
        req.requestReceived(command, path, version)
      File "/usr/lib64/python2.7/site-packages/twisted/web/http.py", line 917, in requestReceived
        self.process()
      File "/usr/lib64/python2.7/site-packages/twisted/web/server.py", line 199, in process
        self.render(resrc)
      File "/usr/lib64/python2.7/site-packages/twisted/web/server.py", line 259, in render
        body = resrc.render(self)
    --- <exception caught here> ---
      File "/usr/lib/python2.7/site-packages/scrapyd/webservice.py", line 21, in render
        return JsonResource.render(self, txrequest).encode('utf-8')
      File "/usr/lib/python2.7/site-packages/scrapyd/utils.py", line 20, in render
        r = resource.Resource.render(self, txrequest)
      File "/usr/lib64/python2.7/site-packages/twisted/web/resource.py", line 250, in render
        return m(request)
      File "/usr/lib/python2.7/site-packages/scrapyd/webservice.py", line 83, in render_POST
        version = txrequest.args[b'version'][0].decode('utf-8')
    exceptions.KeyError: 'version'

我同时检查了客户端和服务器端,Scrapy版本均为1.5.1。 python版本是2.7。*

1 个答案:

答案 0 :(得分:0)

您先前显示的示例curl命令不起作用。根据{{​​3}},您还需要:

  1. 一个version的论点,据信这是您现在遇到的问题的原因。
  2. 一个包含实际项目代码的egg参数,否则,当您仅传入项目名称和蜘蛛名称时,scrapyd将无法接收。