看来不是scrapyd的文档有问题,就是有bug。我想从一个已部署的项目中获取蜘蛛的列表。文档 告诉我这样做。
curl http://localhost:6800/listspiders.json?project=myproject
所以在我的环境中,它看起来像这样。
merlin@192-143-0-9 spider2 % curl http://localhost:6800/listspiders.json?project=crawler
zsh: no matches found: http://localhost:6800/listspiders.json?project=crawler
所以这个命令似乎没有被识别 让我们检查项目的可用性。
merlin@192-143-0-9 spider2 % curl http://localhost:6800/listprojects.json
{"node_name": "192-143-0-9.ip.airmobile.co.za", "status": "ok", "projects": ["crawler"]}
在我看来是可以的
再次查看文档,其他API调用不是以GET的方式获取参数,而是以不同的方式。
curl http://localhost:6800/schedule.json -d project=myproject -d spider=somespider
把这个应用于listspiders:
merlin@192-143-0-9 spider2 % curl http://localhost:6800/listspiders.json -d project=crawler
{"node_name": "192-143-0-9.ip.airmobile.co.za", "status": "error", "message": "Expected one of [b'HEAD', b'object', b'GET']"}
缺少GET参数 所以看起来我们是在兜圈子。
如何用scrapyd检索蜘蛛列表或版本(listversion)?
也许url需要用双引号来包装,可以试试
curl "http://localhost:6800/listspiders.json?project=crawler"