scrapy 1.5版本
scrapy-jsonrpc 源码install的
jsonrpc确定已经启动端口
JSONRPC_ENABLED = True
JSONRPC_PORT = [6025]
EXTENSIONS = {
'scrapy_jsonrpc.webservice.WebService': 500,
}
从example-client.py获取spider信息一直报错
python example-client.py -H localhost -P 6025 get-spider-stats QuTouTiao
/www/python3/scrapy-jsonrpc/scrapy_jsonrpc/jsonrpc.py:40: ScrapyDeprecationWarning: Call to deprecated function unicode_to_str. Use scrapy.utils.python.to_bytes instead.
data = unicode_to_str(json.dumps(req))
Traceback (most recent call last):
File "example-client.py", line 114, in <module>
main()
File "example-client.py", line 103, in main
cmd(args, opts)
File "example-client.py", line 58, in cmd_get_spider_stats
stats = jsonrpc_call(opts, 'crawler/stats', 'get_stats', args[0])
File "example-client.py", line 73, in jsonrpc_call
return jsonrpc_client_call(url, method, *args, **kwargs)
File "/www/python3/scrapy-jsonrpc/scrapy_jsonrpc/jsonrpc.py", line 41, in jsonrpc_client_call
body = urllib.request.urlopen(url, data).read()
File "/root/.pyenv/versions/3.6.8/lib/python3.6/urllib/request.py", line 223, in urlopen
return opener.open(url, data, timeout)
File "/root/.pyenv/versions/3.6.8/lib/python3.6/urllib/request.py", line 532, in open
response = meth(req, response)
File "/root/.pyenv/versions/3.6.8/lib/python3.6/urllib/request.py", line 642, in http_response
'http', request, response, code, msg, hdrs)
File "/root/.pyenv/versions/3.6.8/lib/python3.6/urllib/request.py", line 570, in error
return self._call_chain(*args)
File "/root/.pyenv/versions/3.6.8/lib/python3.6/urllib/request.py", line 504, in _call_chain
result = func(*args)
File "/root/.pyenv/versions/3.6.8/lib/python3.6/urllib/request.py", line 650, in http_error_default
raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 404: Not Found
scrapy-jsonrpc官方-插件无更新
非官方插件 支持scrapy1.5